FIX: allow staff members to restore withdrawn posts that are flagged

This commit is contained in:
Régis Hanol
2014-09-09 20:26:40 +02:00
parent c9dea9ce5c
commit 79030c874e
5 changed files with 29 additions and 31 deletions

View File

@ -26,6 +26,7 @@ module FlagQuery
p.post_number,
p.hidden,
p.deleted_at,
p.user_deleted,
(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