mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: Add a messages view for all official warnings of a user (#12659)
Moderators are allowed to see the warnings list, with an access warning. https://meta.discourse.org/t/why-arent-warnings-easily-accessible-like-suspensions-are/164043
This commit is contained in:
parent
7d8483f698
commit
c780ae9d25
13 changed files with 118 additions and 2 deletions
|
@ -365,6 +365,14 @@ class TopicQuery
|
|||
create_list(:private_messages, {}, list)
|
||||
end
|
||||
|
||||
def list_private_messages_warnings(user)
|
||||
list = private_messages_for(user, :user)
|
||||
list = list.where('topics.subtype = ?', TopicSubtype.moderator_warning)
|
||||
# Exclude official warnings that the user created, instead of received
|
||||
list = list.where('topics.user_id <> ?', user.id)
|
||||
create_list(:private_messages, {}, list)
|
||||
end
|
||||
|
||||
def list_category_topic_ids(category)
|
||||
query = default_results(category: category.id)
|
||||
pinned_ids = query.where('topics.pinned_at IS NOT NULL AND topics.category_id = ?', category.id).limit(nil).order('pinned_at DESC').pluck(:id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue