diff --git a/app/javascript/src/styles/specific/users.scss b/app/javascript/src/styles/specific/users.scss index ba9af319f..93269df0c 100644 --- a/app/javascript/src/styles/specific/users.scss +++ b/app/javascript/src/styles/specific/users.scss @@ -1,11 +1,5 @@ div#c-users { div#a-show { - div.moderation-users-notice { - margin: 1em 0; - font-weight: bold; - color: var(--moderation-report-text-color); - } - div.box { margin-bottom: 2em; } diff --git a/app/models/moderation_report.rb b/app/models/moderation_report.rb index 20874e2d1..f7a3312dc 100644 --- a/app/models/moderation_report.rb +++ b/app/models/moderation_report.rb @@ -1,26 +1,23 @@ class ModerationReport < ApplicationRecord + MODEL_TYPES = %w[Dmail Comment ForumPost] + belongs_to :model, polymorphic: true belongs_to :creator, class_name: "User" validates :reason, presence: true - validates :model_type, inclusion: { in: %w[Comment Dmail ForumPost User] } + validates :model_type, inclusion: { in: MODEL_TYPES } validates :creator, uniqueness: { scope: [:model_type, :model_id], message: "have already reported this message." } after_create :create_forum_post! after_create :autoban_reported_user - scope :user, -> { where(model_type: "User") } scope :dmail, -> { where(model_type: "Dmail") } scope :comment, -> { where(model_type: "Comment") } scope :forum_post, -> { where(model_type: "ForumPost") } scope :recent, -> { where("moderation_reports.created_at >= ?", 1.week.ago) } - def self.enabled? - !Rails.env.production? - end - def self.model_types - %w[User Dmail Comment ForumPost] + MODEL_TYPES end def forum_topic_title diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb index f065c4668..d02848a07 100644 --- a/app/policies/user_policy.rb +++ b/app/policies/user_policy.rb @@ -19,10 +19,6 @@ class UserPolicy < ApplicationPolicy !user.is_anonymous? end - def reportable? - false - end - def fix_counts? !user.is_anonymous? end diff --git a/app/views/moderation_reports/index.html.erb b/app/views/moderation_reports/index.html.erb index dcf471a19..2ac33377a 100644 --- a/app/views/moderation_reports/index.html.erb +++ b/app/views/moderation_reports/index.html.erb @@ -3,9 +3,7 @@