Merge pull request #3361 from BrokenEagle/fix-3351

Change visible/hidden on comments for moderators
This commit is contained in:
Albert Yi
2017-11-13 14:56:13 -08:00
committed by GitHub

View File

@@ -40,12 +40,20 @@ class Comment < ApplicationRecord
end end
def hidden(user) def hidden(user)
if user.is_moderator?
where("(score < ? and is_sticky = false) or is_deleted = true", user.comment_threshold)
else
where("score < ? and is_sticky = false", user.comment_threshold) where("score < ? and is_sticky = false", user.comment_threshold)
end end
end
def visible(user) def visible(user)
if user.is_moderator?
where("(score >= ? or is_sticky = true) and is_deleted = false", user.comment_threshold)
else
where("score >= ? or is_sticky = true", user.comment_threshold) where("score >= ? or is_sticky = true", user.comment_threshold)
end end
end
def deleted def deleted
where("comments.is_deleted = true") where("comments.is_deleted = true")