comments: allow admins to remove comment votes (fix #4640)
Allow admins to remove comment votes by other users. This is done by clicking the comment score to get to the comment vote list, then clicking the Remove button on every vote.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
<%= fc.input :post_id, label: "Post", input_html: { value: params.dig(:search, :comment, :post_id) } %>
|
||||
<% end %>
|
||||
<%= f.input :comment_id, label: "Comment", input_html: { value: params[:search][:comment_id] } %>
|
||||
<%= f.input :is_deleted, label: "Deleted?", as: :select, include_blank: true, selected: params[:search][:is_deleted] %>
|
||||
<%= f.input :score, collection: [["+1", "1"], ["-1", "-1"]], include_blank: true, selected: params[:search][:score] %>
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
2
app/views/comment_votes/destroy.js+listing.erb
Normal file
2
app/views/comment_votes/destroy.js+listing.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
Danbooru.Utility.notice("Vote removed");
|
||||
location.reload();
|
||||
@@ -14,9 +14,23 @@
|
||||
<%= link_to "»", comment_votes_path(search: { user_name: vote.user.name }) %>
|
||||
<% end %>
|
||||
|
||||
<% t.column "Status" do |vote| %>
|
||||
<%= "Deleted" if vote.is_deleted? %>
|
||||
<% end %>
|
||||
|
||||
<% t.column "Created" do |vote| %>
|
||||
<%= time_ago_in_words_tagged(vote.created_at) %>
|
||||
<% end %>
|
||||
|
||||
<% t.column column: "control" do |vote| %>
|
||||
<% if policy(vote).destroy? %>
|
||||
<%= render PopupMenuComponent.new do |menu| %>
|
||||
<%= menu.item do %>
|
||||
<%= link_to "Remove", comment_vote_path(vote, variant: "listing"), remote: true, method: :delete %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= numbered_paginator(@comment_votes) %>
|
||||
|
||||
@@ -8,27 +8,40 @@
|
||||
<% t.column "Post" do |vote| %>
|
||||
<%= post_preview(vote.comment.post, show_deleted: true) %>
|
||||
<% end %>
|
||||
|
||||
<% t.column "Comment", td: {class: "col-expand"} do |vote| %>
|
||||
<div class="prose">
|
||||
<%= format_text(vote.comment.body) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% t.column "Status" do |vote| %>
|
||||
<%= "Deleted" if vote.is_deleted? %>
|
||||
<% end %>
|
||||
|
||||
<% t.column "Score" do |vote| %>
|
||||
<%= link_to sprintf("%+d", vote.score), comment_votes_path(search: { score: vote.score }) %>
|
||||
<% end %>
|
||||
|
||||
<% t.column "Commenter" do |vote| %>
|
||||
<%= link_to_user vote.comment.creator %>
|
||||
<%= link_to "»", comment_votes_path(search: { comment: { creator_name: vote.comment.creator.name }}) %>
|
||||
<div><%= time_ago_in_words_tagged(vote.comment.created_at) %></div>
|
||||
<% end %>
|
||||
|
||||
<% t.column "Voter" do |vote| %>
|
||||
<%= link_to_user vote.user %>
|
||||
<%= link_to "»", comment_votes_path(search: { user_name: vote.user.name }) %>
|
||||
<div><%= time_ago_in_words_tagged(vote.created_at) %></div>
|
||||
<% end %>
|
||||
|
||||
<% t.column column: "control" do |vote| %>
|
||||
<% if vote.user == CurrentUser.user %>
|
||||
<%= link_to "unvote", comment_comment_votes_path(vote.comment), remote: true, method: :delete %>
|
||||
<% if policy(vote).destroy? %>
|
||||
<%= render PopupMenuComponent.new do |menu| %>
|
||||
<%= menu.item do %>
|
||||
<%= link_to "Remove", comment_vote_path(vote, variant: "listing"), remote: true, method: :delete %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user