Made recommended changes to moderator reports (see #4267)
This commit is contained in:
@@ -17,7 +17,6 @@ class ModerationReportsController < ApplicationController
|
|||||||
def create
|
def create
|
||||||
check_privilege
|
check_privilege
|
||||||
@moderation_report = ModerationReport.create(moderation_report_params)
|
@moderation_report = ModerationReport.create(moderation_report_params)
|
||||||
@moderation_report.create_forum_post!
|
|
||||||
respond_with(@moderation_report)
|
respond_with(@moderation_report)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,9 @@
|
|||||||
--forum-vote-meh-color: goldenrod;
|
--forum-vote-meh-color: goldenrod;
|
||||||
--forum-vote-down-color: red;
|
--forum-vote-down-color: red;
|
||||||
|
|
||||||
|
--moderation-report-text-color: red;
|
||||||
|
--moderation-report-border: 2px solid red;
|
||||||
|
|
||||||
--comment-sticky-background-color: var(--subnav-menu-background-color);
|
--comment-sticky-background-color: var(--subnav-menu-background-color);
|
||||||
|
|
||||||
--post-tooltip-background-color: var(--body-background-color);
|
--post-tooltip-background-color: var(--body-background-color);
|
||||||
@@ -333,6 +336,9 @@ body[data-current-user-theme="dark"] {
|
|||||||
--forum-vote-meh-color: var(--yellow-1);
|
--forum-vote-meh-color: var(--yellow-1);
|
||||||
--forum-vote-down-color: var(--red-1);
|
--forum-vote-down-color: var(--red-1);
|
||||||
|
|
||||||
|
--moderation-report-text-color: var(--red-1);
|
||||||
|
--moderation-report-border: 2px solid var(--red-1);
|
||||||
|
|
||||||
--jquery-ui-widget-content-text-color: var(--text-color);
|
--jquery-ui-widget-content-text-color: var(--text-color);
|
||||||
--jquery-ui-widget-content-background: var(--grey-2);
|
--jquery-ui-widget-content-background: var(--grey-2);
|
||||||
--jquery-ui-dialog-box-shadow: 0 0 8px var(--grey-1);
|
--jquery-ui-dialog-box-shadow: 0 0 8px var(--grey-1);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ div.comments-for-post {
|
|||||||
div.moderation-comments-notice {
|
div.moderation-comments-notice {
|
||||||
margin: 1em 0;
|
margin: 1em 0;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: red;
|
color: var(--moderation-report-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
div.hidden-comments-notice {
|
div.hidden-comments-notice {
|
||||||
@@ -20,7 +20,7 @@ div.comments-for-post {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&[data-is-reported="true"] {
|
&[data-is-reported="true"] {
|
||||||
border: solid red;
|
border: var(--moderation-report-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
&[data-is-voted="true"] {
|
&[data-is-voted="true"] {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
div.list-of-forum-posts {
|
div.list-of-forum-posts {
|
||||||
div.moderation-forums-notice {
|
div.moderation-forums-notice {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: red;
|
color: var(--moderation-report-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
article.forum-post {
|
article.forum-post {
|
||||||
&[data-is-reported="true"] {
|
&[data-is-reported="true"] {
|
||||||
border: solid red;
|
border: var(--moderation-report-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
a.voted {
|
a.voted {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ div#c-users {
|
|||||||
div.moderation-users-notice {
|
div.moderation-users-notice {
|
||||||
margin: 1em 0;
|
margin: 1em 0;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: red;
|
color: var(--moderation-report-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
div.box {
|
div.box {
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ module DanbooruMaintenance
|
|||||||
safely { TagChangeRequestPruner.warn_all }
|
safely { TagChangeRequestPruner.warn_all }
|
||||||
safely { TagChangeRequestPruner.reject_all }
|
safely { TagChangeRequestPruner.reject_all }
|
||||||
safely { Ban.prune! }
|
safely { Ban.prune! }
|
||||||
safely { ModerationReport.prune! }
|
|
||||||
safely { CuratedPoolUpdater.update_pool! }
|
safely { CuratedPoolUpdater.update_pool! }
|
||||||
safely { ActiveRecord::Base.connection.execute("vacuum analyze") unless Rails.env.test? }
|
safely { ActiveRecord::Base.connection.execute("vacuum analyze") unless Rails.env.test? }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -184,6 +184,6 @@ class ForumTopic < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def viewable_moderation_reports
|
def viewable_moderation_reports
|
||||||
CurrentUser.is_moderator? ? moderation_reports : []
|
CurrentUser.is_moderator? ? moderation_reports.recent : []
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,9 +2,13 @@ class ModerationReport < ApplicationRecord
|
|||||||
belongs_to :model, polymorphic: true
|
belongs_to :model, polymorphic: true
|
||||||
belongs_to_creator
|
belongs_to_creator
|
||||||
|
|
||||||
|
validates :reason, presence: true
|
||||||
|
after_create :create_forum_post!
|
||||||
|
|
||||||
scope :user, -> { where(model_type: "User") }
|
scope :user, -> { where(model_type: "User") }
|
||||||
scope :comment, -> { where(model_type: "Comment") }
|
scope :comment, -> { where(model_type: "Comment") }
|
||||||
scope :forum_post, -> { where(model_type: "ForumPost") }
|
scope :forum_post, -> { where(model_type: "ForumPost") }
|
||||||
|
scope :recent, -> { where("moderation_reports.created_at >= ?", 1.week.ago) }
|
||||||
|
|
||||||
def forum_topic_title
|
def forum_topic_title
|
||||||
"Reports requiring moderation"
|
"Reports requiring moderation"
|
||||||
@@ -54,8 +58,4 @@ class ModerationReport < ApplicationRecord
|
|||||||
|
|
||||||
q.apply_default_order(params)
|
q.apply_default_order(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.prune!
|
|
||||||
where("created_at < ?", 1.week.ago).delete_all
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1814,6 +1814,6 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def viewable_moderation_reports
|
def viewable_moderation_reports
|
||||||
CurrentUser.is_moderator? ? moderation_reports : []
|
CurrentUser.is_moderator? ? moderation_reports.recent : []
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -814,6 +814,6 @@ class User < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def viewable_moderation_reports
|
def viewable_moderation_reports
|
||||||
!is_moderator? && CurrentUser.is_moderator? ? moderation_reports : []
|
CurrentUser.is_moderator? ? moderation_reports.recent : []
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<% if post.viewable_moderation_reports.present? %>
|
<% if post.viewable_moderation_reports.present? %>
|
||||||
<div class="row moderation-comments-notice">
|
<div class="row moderation-comments-notice">
|
||||||
<span class="info" id="moderation-comments-notice-for-<%= post.id %>">
|
<span class="info" id="moderation-comments-notice-for-<%= post.id %>">
|
||||||
This post has comments reported for moderation! (<%= post.moderation_reports.length %> <%= (post.moderation_reports.length == 1 ? "report" : "reports") %>)
|
This post has comments reported for moderation! (<%= pluralize(post.viewable_moderation_reports.length, "report") %>)
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<% if moderation_reports.present? %>
|
<% if moderation_reports.present? %>
|
||||||
<div class="row moderation-forums-notice">
|
<div class="row moderation-forums-notice">
|
||||||
<span class="info" id="moderation-forums-notice-for-topic">
|
<span class="info" id="moderation-forums-notice-for-topic">
|
||||||
This topic has forum posts reported for moderation! (<%= moderation_reports.length %> <%= (moderation_reports.length == 1 ? "report" : "reports") %>)
|
This topic has forum posts reported for moderation! (<%= pluralize(moderation_reports.length, "report") %>)
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<% if @user.viewable_moderation_reports.present? %>
|
<% if @user.viewable_moderation_reports.present? %>
|
||||||
<div class="moderation-users-notice">
|
<div class="moderation-users-notice">
|
||||||
<span class="info" id="moderation-users-notice-for-<%= @user.id %>">
|
<span class="info" id="moderation-users-notice-for-<%= @user.id %>">
|
||||||
This user has been reported for moderation! (<%= @user.moderation_reports.length %> <%= (@user.moderation_reports.length == 1 ? "report" : "reports") %>)
|
This user has been reported for moderation! (<%= pluralize(@user.viewable_moderation_reports.length, "report") %>)
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user