pundit: convert moderation reports to pundit.
This commit is contained in:
@@ -117,10 +117,6 @@ class Comment < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def reportable_by?(user)
|
||||
creator_id != user.id && !creator.is_moderator?
|
||||
end
|
||||
|
||||
def voted_by?(user)
|
||||
return false if user.is_anonymous?
|
||||
user.id.in?(votes.map(&:user_id))
|
||||
|
||||
@@ -169,10 +169,6 @@ class Dmail < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def reportable_by?(user)
|
||||
owner == user && is_recipient? && !is_automated? && !from.is_moderator?
|
||||
end
|
||||
|
||||
def dtext_shortlink(key: false, **options)
|
||||
key ? "dmail ##{id}/#{self.key}" : "dmail ##{id}"
|
||||
end
|
||||
|
||||
@@ -81,10 +81,6 @@ class ForumPost < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def reportable_by?(user)
|
||||
visible?(user) && creator_id != user.id && !creator.is_moderator?
|
||||
end
|
||||
|
||||
def votable?
|
||||
bulk_update_request.present? && bulk_update_request.is_pending?
|
||||
end
|
||||
@@ -99,10 +95,6 @@ class ForumPost < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def visible?(user, show_deleted_posts = false)
|
||||
user.is_moderator? || (user.level >= topic.min_level && (show_deleted_posts || !is_deleted?))
|
||||
end
|
||||
|
||||
def update_topic_updated_at_on_create
|
||||
if topic
|
||||
# need to do this to bypass the topic's original post from getting touched
|
||||
|
||||
@@ -697,10 +697,6 @@ class User < ApplicationRecord
|
||||
CurrentUser.as(self, &block)
|
||||
end
|
||||
|
||||
def reportable_by?(user)
|
||||
ModerationReport.enabled? && user.is_builder? && id != user.id && !is_moderator?
|
||||
end
|
||||
|
||||
def hide_favorites?
|
||||
!CurrentUser.is_admin? && enable_private_favorites? && CurrentUser.user.id != id
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user