posts/show: fix 'Flag' option in sidebar.
* Don't show 'Flag' option on already flagged posts. * Drop flag/appeal link show/hide Javascript (did nothing, links were already shown/hidden in html).
This commit is contained in:
@@ -1,17 +1,8 @@
|
||||
import Utility from './utility'
|
||||
|
||||
let PostAppeal = {};
|
||||
|
||||
PostAppeal.initialize_all = function() {
|
||||
if ($("#c-posts").length && $("#a-show").length) {
|
||||
this.initialize_appeal();
|
||||
this.hide_or_show_appeal_link();
|
||||
}
|
||||
}
|
||||
|
||||
PostAppeal.hide_or_show_appeal_link = function() {
|
||||
if ((Utility.meta("post-is-flagged") === "false") && (Utility.meta("post-is-deleted") === "false")) {
|
||||
$("#appeal").hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
import Utility from './utility'
|
||||
|
||||
let PostFlag = {};
|
||||
|
||||
PostFlag.initialize_all = function() {
|
||||
if ($("#c-posts").length && $("#a-show").length) {
|
||||
this.initialize_flag();
|
||||
this.hide_or_show_flag_link();
|
||||
}
|
||||
}
|
||||
|
||||
PostFlag.hide_or_show_flag_link = function() {
|
||||
if (Utility.meta("post-is-deleted") === "true") {
|
||||
$("#flag").hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,9 @@
|
||||
<% if post.is_status_locked? %>
|
||||
<li><span id="status-locked-notice">Status locked</span></li>
|
||||
<% else %>
|
||||
<% if !post.is_deleted? && !post.is_pending? %>
|
||||
<% if !post.is_deleted? && !post.is_pending? && !post.is_flagged? %>
|
||||
<li><%= link_to "Flag", new_post_flag_path(:post_id => post.id), :id => "flag" %></li>
|
||||
<% end %>
|
||||
|
||||
<% if post.is_flagged? || post.is_deleted? %>
|
||||
<% elsif post.is_flagged? || post.is_deleted? %>
|
||||
<li><%= link_to "Appeal", new_post_appeal_path(:post_id => post.id), :id => "appeal" %></li>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user