posts/show: fix 'Hide from queue' option in sidebar.

Fix 'Hide from queue' option appearing on deleted posts, but not on
pending or flagged posts.
This commit is contained in:
evazion
2018-08-14 12:48:13 -05:00
parent 41a7923ade
commit d7ec28b804
2 changed files with 1 additions and 31 deletions

View File

@@ -1,29 +0,0 @@
import Utility from './utility'
let PostModeration = {};
PostModeration.initialize_all = function() {
if ($("#c-posts").length && $("#a-show").length) {
this.hide_or_show_approve_and_disapprove_links();
this.hide_or_show_delete_and_undelete_links();
}
}
PostModeration.hide_or_show_approve_and_disapprove_links = function() {
if (Utility.meta("post-is-approvable") !== "true") {
$("#approve").hide();
$("#disapprove").hide();
}
}
PostModeration.hide_or_show_delete_and_undelete_links = function() {
if (Utility.meta("post-is-deleted") === "true") {
$("#delete").hide();
} else {
$("#undelete").hide();
}
}
$(document).ready(function() {
PostModeration.initialize_all();
});

View File

@@ -39,9 +39,8 @@
<li><%= link_to "Delete", confirm_delete_moderator_post_post_path(:post_id => post.id) %></li>
<% end %>
<% if post.is_flagged? || post.is_pending? %>
<% if post.is_approvable? && !post.is_deleted? %>
<li><%= link_to "Approve", moderator_post_approval_path(:post_id => post.id), :remote => true, :method => :post, :id => "approve", :"data-shortcut" => "shift+o", :"data-confirm" => "Are you sure you want to approve this post?" %></li>
<% else %>
<li><%= link_to "Hide from queue", moderator_post_disapproval_path(post_disapproval: { post_id: post.id, reason: "disinterest" }), remote: true, method: :post, id: "disapprove" %></li>
<% end %>