Record when a post was hidden

This commit is contained in:
Robin Ward
2014-06-20 15:03:23 -04:00
parent 533244f39d
commit 3811efa5e2
4 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -307,7 +307,7 @@ class PostAction < ActiveRecord::Base
reason = guess_hide_reason(old_flags)
end
Post.where(id: post.id).update_all(["hidden = true, hidden_reason_id = COALESCE(hidden_reason_id, ?)", reason])
Post.where(id: post.id).update_all(["hidden = true, hidden_at = CURRENT_TIMESTAMP, hidden_reason_id = COALESCE(hidden_reason_id, ?)", reason])
Topic.where(["id = :topic_id AND NOT EXISTS(SELECT 1 FROM POSTS WHERE topic_id = :topic_id AND NOT hidden)",
topic_id: post.topic_id]).update_all({ visible: false })