mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:01:20 +08:00
FEATURE: add count of previous flags on the post
This commit is contained in:
@ -26,11 +26,8 @@ module FlagQuery
|
||||
p.post_number,
|
||||
p.hidden,
|
||||
p.deleted_at,
|
||||
(SELECT pr.created_at
|
||||
FROM post_revisions pr
|
||||
WHERE pr.post_id = p.id AND pr.user_id = p.user_id
|
||||
ORDER BY created_at DESC
|
||||
LIMIT 1) AS last_revised_at
|
||||
(SELECT created_at FROM post_revisions WHERE post_id = p.id AND user_id = p.user_id ORDER BY created_at DESC LIMIT 1) AS last_revised_at,
|
||||
(SELECT COUNT(*) FROM post_actions WHERE (disagreed_at IS NOT NULL OR agreed_at IS NOT NULL OR deferred_at IS NOT NULL) AND post_id = p.id)::int AS previous_flags_count
|
||||
FROM posts p
|
||||
WHERE p.id in (:post_ids)").map_exec(OpenStruct, post_ids: post_ids)
|
||||
|
||||
|
Reference in New Issue
Block a user