mod reports: enable reporting for members, add dmail reporting.
* Add ability to report dmails. * Enable reports for comments, forum posts, and dmails. * Allow Members to send reports. * Don't allow users to report the same thing twice.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
$("#threshold-comments-notice-for-<%= @post.id %>").hide();
|
||||
|
||||
var current_comment_section = $("div.comments-for-post[data-post-id=<%= @post.id %>] div.list-of-comments");
|
||||
current_comment_section.html("<%= j(render(partial: 'comments/partials/show/comment', collection: @comments, locals: { context: :index_for_post, dtext_data: DText.preprocess(@comments.map(&:body)), moderation_reports: @post.viewable_moderation_reports })) %>");
|
||||
current_comment_section.html("<%= j(render(partial: 'comments/partials/show/comment', collection: @comments, locals: { context: :index_for_post, dtext_data: DText.preprocess(@comments.map(&:body)), moderation_reports: @post.moderation_reports.visible.recent })) %>");
|
||||
$(window).trigger("danbooru:index_for_post", [<%= @post.id %>]);
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
<%= render "comments/partials/index/header", :post => post %>
|
||||
<% end %>
|
||||
|
||||
<% if post.viewable_moderation_reports.present? %>
|
||||
<% if post.moderation_reports.visible.recent.present? %>
|
||||
<div class="row moderation-comments-notice">
|
||||
<span class="info" id="moderation-comments-notice-for-<%= post.id %>">
|
||||
This post has comments reported for moderation! (<%= pluralize(post.viewable_moderation_reports.length, "report") %>)
|
||||
This post has comments reported for moderation! (<%= pluralize(post.moderation_reports.visible.recent.length, "report") %>)
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<div class="list-of-comments list-of-messages">
|
||||
<% if comments.present? %>
|
||||
<%= render partial: "comments/partials/show/comment", collection: comments, locals: { context: :index_by_post, dtext_data: DText.preprocess(comments.map(&:body)), moderation_reports: post.viewable_moderation_reports } %>
|
||||
<%= render partial: "comments/partials/show/comment", collection: comments, locals: { context: :index_by_post, dtext_data: DText.preprocess(comments.map(&:body)), moderation_reports: post.moderation_reports.visible.recent } %>
|
||||
<% elsif post.last_commented_at.present? %>
|
||||
<p>There are no visible comments.</p>
|
||||
<% else %>
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<%= link_to "Unvote", comment_comment_votes_path(comment_id: comment.id), method: :delete, remote: true %>
|
||||
</li>
|
||||
<% if comment.reportable_by?(CurrentUser.user) %>
|
||||
<li><%= link_to "Report comment", new_moderation_report_path(moderation_report: { model_type: "Comment", model_id: comment.id }), remote: true %></li>
|
||||
<li><%= link_to "Report", new_moderation_report_path(moderation_report: { model_type: "Comment", model_id: comment.id }), remote: true %></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
<% if comment.editable_by?(CurrentUser.user) %>
|
||||
|
||||
@@ -33,10 +33,13 @@
|
||||
<% if @dmail.is_spam? %>
|
||||
| <%= link_to "Not spam", ham_dmail_path(@dmail), remote: :true, method: :post %>
|
||||
<% else %>
|
||||
| <%= link_to "Mark as spam", spam_dmail_path(@dmail), remote: :true, method: :post %>
|
||||
| <%= link_to "Spam", spam_dmail_path(@dmail), remote: :true, method: :post %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% if @dmail.reportable_by?(CurrentUser.user) %>
|
||||
| <%= link_to "Report", new_moderation_report_path(moderation_report: { model_type: "Dmail", model_id: @dmail.id }), remote: true, title: "Report this dmail to the moderators" %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if forum_post.reportable_by?(CurrentUser.user) %>
|
||||
<li><%= link_to "Report forum", new_moderation_report_path(moderation_report: { model_type: "ForumPost", model_id: forum_post.id }), remote: true %></li>
|
||||
<li><%= link_to "Report", new_moderation_report_path(moderation_report: { model_type: "ForumPost", model_id: forum_post.id }), remote: true, title: "Report this forum post to the moderators" %></li>
|
||||
<% end %>
|
||||
<% if forum_post.votable? %>
|
||||
<ul class="votes" id="forum-post-votes-for-<%= forum_post.id %>">
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "forum_posts/listing", forum_posts: @forum_posts, original_forum_post_id: @forum_topic.original_post&.id, dtext_data: DText.preprocess(@forum_posts.map(&:body)), moderation_reports: @forum_topic.viewable_moderation_reports %>
|
||||
<%= render "forum_posts/listing", forum_posts: @forum_posts, original_forum_post_id: @forum_topic.original_post&.id, dtext_data: DText.preprocess(@forum_posts.map(&:body)), moderation_reports: @forum_topic.moderation_reports.visible.recent %>
|
||||
|
||||
<% if CurrentUser.is_member? %>
|
||||
<% if CurrentUser.is_moderator? || !@forum_topic.is_locked? %>
|
||||
|
||||
@@ -1 +1 @@
|
||||
Danbooru.notice("Report submitted.");
|
||||
Danbooru.notice("<%= j flash[:notice] %>");
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
<% t.column "Reported", width: "10%" do |report| %>
|
||||
<% if report.model_type == "User" %>
|
||||
<%= link_to_user report.model %>
|
||||
<% elsif report.model_type == "Comment" %>
|
||||
<%= link_to "comment ##{report.model_id}", comment_path(report.model_id) %>
|
||||
<% elsif report.model_type == "ForumPost" %>
|
||||
<%= link_to "forum ##{report.model_id}", forum_post_path(report.model_id) %>
|
||||
<% elsif report.model_type == "Dmail" %>
|
||||
<%= link_to report.model.dtext_shortlink, dmail_path(report.model, key: report.model.key) %>
|
||||
<% else %>
|
||||
<%= link_to report.model.dtext_shortlink, report.model %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column "Reason" do |report| %>
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
<div id="a-show">
|
||||
<h1><%= link_to_user @user %></h1>
|
||||
|
||||
<% if @user.viewable_moderation_reports.present? %>
|
||||
<% if @user.moderation_reports.visible.recent.present? %>
|
||||
<div class="moderation-users-notice">
|
||||
<span class="info" id="moderation-users-notice-for-<%= @user.id %>">
|
||||
This user has been reported for moderation! (<%= pluralize(@user.viewable_moderation_reports.length, "report") %>)
|
||||
This user has been reported for moderation! (<%= pluralize(@user.moderation_reports.visible.recent.length, "report") %>)
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user