posts: show only last successful flag on deleted posts.
In the "This post was deleted" notice, show only the last successful flag, instead of all previous flags (which may include rejected flags).
This commit is contained in:
@@ -25,9 +25,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<% elsif post.is_deleted? %>
|
<% elsif post.is_deleted? %>
|
||||||
<div class="notice notice-small post-notice post-notice-deleted">
|
<div class="notice notice-small post-notice post-notice-deleted">
|
||||||
<% if post.flags.any? %>
|
<% if post.flags.succeeded.last.present? %>
|
||||||
<p>This post was deleted for the following reasons: </p>
|
<p>This post was deleted for the following reason: </p>
|
||||||
<%= render "post_flags/reasons", flags: post.flags %>
|
<%= render "post_flags/reasons", flag: post.flags.succeeded.last %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p>This post was deleted</p>
|
<p>This post was deleted</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -540,6 +540,15 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "a deleted post" do
|
||||||
|
should "render" do
|
||||||
|
@post.delete!("no", user: @user)
|
||||||
|
get post_path(@post)
|
||||||
|
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "with pools" do
|
context "with pools" do
|
||||||
should "render the pool list" do
|
should "render the pool list" do
|
||||||
as(@user) { @post.update(tag_string: "newpool:comic") }
|
as(@user) { @post.update(tag_string: "newpool:comic") }
|
||||||
|
|||||||
Reference in New Issue
Block a user