mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: allow moderators to see flagged private messages
This commit is contained in:
parent
0b45054e2b
commit
3cad4824d7
3 changed files with 42 additions and 20 deletions
|
@ -6,7 +6,9 @@ module FlagQuery
|
|||
guardian = Guardian.new(current_user)
|
||||
|
||||
if !guardian.is_admin?
|
||||
actions = actions.where('category_id in (?)', guardian.allowed_category_ids)
|
||||
actions = actions.where('category_id IN (:allowed_category_ids) OR archetype = :private_message',
|
||||
allowed_category_ids: guardian.allowed_category_ids,
|
||||
private_message: Archetype.private_message)
|
||||
end
|
||||
|
||||
post_ids = actions.limit(per_page)
|
||||
|
@ -107,26 +109,24 @@ module FlagQuery
|
|||
]
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def self.flagged_post_actions(filter)
|
||||
post_actions = PostAction.flags
|
||||
.joins("INNER JOIN posts ON posts.id = post_actions.post_id")
|
||||
.joins("INNER JOIN topics ON topics.id = posts.topic_id")
|
||||
.joins("LEFT JOIN users ON users.id = posts.user_id")
|
||||
|
||||
if filter == "old"
|
||||
post_actions.where("post_actions.disagreed_at IS NOT NULL OR
|
||||
post_actions.deferred_at IS NOT NULL OR
|
||||
post_actions.agreed_at IS NOT NULL")
|
||||
else
|
||||
post_actions.active
|
||||
.where("posts.deleted_at" => nil)
|
||||
.where("topics.deleted_at" => nil)
|
||||
end
|
||||
def self.flagged_post_actions(filter)
|
||||
post_actions = PostAction.flags
|
||||
.joins("INNER JOIN posts ON posts.id = post_actions.post_id")
|
||||
.joins("INNER JOIN topics ON topics.id = posts.topic_id")
|
||||
.joins("LEFT JOIN users ON users.id = posts.user_id")
|
||||
|
||||
if filter == "old"
|
||||
post_actions.where("post_actions.disagreed_at IS NOT NULL OR
|
||||
post_actions.deferred_at IS NOT NULL OR
|
||||
post_actions.agreed_at IS NOT NULL")
|
||||
else
|
||||
post_actions.active
|
||||
.where("posts.deleted_at" => nil)
|
||||
.where("topics.deleted_at" => nil)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def self.excerpt(cooked)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue