flags: only show current flag on flagged posts.

* Only show the current pending flag on flagged posts. Don't show old flags.

* Don't show both the "This post was flagged for review" and the "This
  post was flagged and is pending" notices.
This commit is contained in:
evazion
2020-08-16 11:09:48 -05:00
parent 7eb9f0b75e
commit 317cfe19b4
5 changed files with 30 additions and 44 deletions

View File

@@ -64,7 +64,7 @@
<% if post.is_flagged? %>
<span class="info">
<strong>Flagged</strong>
<%= render "post_flags/reasons", flags: post.flags %>
<%= render "post_flags/reasons", flag: post.flags.select(&:pending?).last %>
</span>
<% end %>

View File

@@ -1,13 +1,11 @@
<ul class="post-flag-reasons list-bulleted">
<% flags.each do |flag| %>
<li class="post-flag-reason">
<span class="prose"><%= format_text(flag.reason, inline: true) %></span>
<ul class="post-flag-reason list-bulleted">
<li>
<span class="prose"><%= format_text(flag.reason, inline: true) %></span>
<% if policy(flag).can_view_flagger? %>
- <%= link_to_user(flag.creator) %>
<% end %>
- <%= time_ago_in_words_tagged(flag.created_at) %>
</li>
<% end %>
<% if policy(flag).can_view_flagger? %>
(<%= link_to_user(flag.creator) %>, <%= time_ago_in_words_tagged(flag.created_at) %>)
<% else %>
(<%= time_ago_in_words_tagged(flag.created_at) %>)
<% end %>
</li>
</ul>

View File

@@ -1,18 +1,29 @@
<% if post.is_flagged? %>
<div class="notice notice-small post-notice post-notice-flagged">
<p>This post was flagged for review (<%= link_to_wiki "learn more", "howto:flag" %>): </p>
<%= render "post_flags/reasons", flags: post.flags %>
</div>
<% end %>
<% if post.is_banned? %>
<div class="notice notice-small post-notice post-notice-banned">
The artist requested removal of this page
</div>
<% end %>
<% if post.is_deleted? && !post.is_appealed? %>
<% if post.in_modqueue? %>
<div class="notice notice-small post-notice post-notice-pending">
<% if post.is_pending? %>
This post is pending approval. (<%= link_to_wiki "learn more", "about:mod_queue" %>)
<% elsif post.is_flagged? %>
This post was flagged and is pending approval (<%= link_to_wiki "learn more", "howto:flag" %>)
<%= render "post_flags/reasons", flag: post.flags.select(&:pending?).last %>
<% elsif post.is_appealed? %>
This post was appealed and is pending approval (<%= link_to_wiki "learn more", "about:mod_queue" %>)
<%= render "post_appeals/reasons", appeal: post.appeals.select(&:pending?).last %>
<% end %>
<%= render "post_disapprovals/counts", :disapprovals => post.disapprovals, :post => post %>
<% if policy(PostDisapproval).create? && !post.disapproved_by?(CurrentUser.user) %>
<%= render "modqueue/quick_mod", post: post %>
<%= render "post_disapprovals/detailed_rejection_dialog" %>
<% end %>
</div>
<% elsif post.is_deleted? %>
<div class="notice notice-small post-notice post-notice-deleted">
<% if post.flags.any? %>
<p>This post was deleted for the following reasons: </p>
@@ -30,26 +41,6 @@
</div>
<% end %>
<% if post.in_modqueue? %>
<div class="notice notice-small post-notice post-notice-pending">
<% if post.is_pending? %>
This post is pending approval. (<%= link_to_wiki "learn more", "about:mod_queue" %>)
<% elsif post.is_flagged? %>
This post was flagged and is pending approval (<%= link_to_wiki "learn more", "about:mod_queue" %>)
<% elsif post.is_appealed? %>
This post was appealed and is pending approval (<%= link_to_wiki "learn more", "about:mod_queue" %>)
<%= render "post_appeals/reasons", appeal: post.appeals.select(&:pending?).last %>
<% end %>
<%= render "post_disapprovals/counts", :disapprovals => post.disapprovals, :post => post %>
<% if policy(PostDisapproval).create? && !post.disapproved_by?(CurrentUser.user) %>
<%= render "modqueue/quick_mod", post: post %>
<%= render "post_disapprovals/detailed_rejection_dialog" %>
<% end %>
</div>
<% end %>
<% if post.parent.present? %>
<div class="notice notice-small post-notice post-notice-child">
<%= render "posts/partials/show/parent_notice", parent: post.parent, children: @sibling_posts.to_a %>