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,11 +40,19 @@ class Comment < ApplicationRecord
end
def hidden(user)
where("score < ? and is_sticky = false", user.comment_threshold)
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)
end
end
def visible(user)
where("score >= ? or is_sticky = true", user.comment_threshold)
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)
end
end
def deleted