comments: change 'Show all comments' to 'Show N hidden comments'.
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<div class="row notices">
|
<div class="row notices">
|
||||||
<% if post.comments.hidden(CurrentUser.user).any? || (page == :comments && post.comments.size > 6) %>
|
<% if post.comments.hidden(CurrentUser.user).any? || (page == :comments && post.comments.size > 6) %>
|
||||||
<span class="info" id="threshold-comments-notice-for-<%= post.id %>">
|
<span class="info" id="threshold-comments-notice-for-<%= post.id %>">
|
||||||
<%= link_to "Show all comments", comments_path(post_id: post.id), id: "show-all-comments-link", remote: true %>
|
<%= link_to "Show #{pluralize post.comments.hidden(CurrentUser.user).size, "hidden comment"}", comments_path(post_id: post.id), id: "show-all-comments-link", remote: true %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -35,18 +35,18 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
assert_select "#post_#{@post.id} #show-all-comments-link", 0
|
assert_select "#post_#{@post.id} #show-all-comments-link", 0
|
||||||
end
|
end
|
||||||
|
|
||||||
should "show the 'Show all comments' link on posts with thresholded comments" do
|
should "show the 'Show hidden comments' link on posts with thresholded comments" do
|
||||||
as(@user) { create(:comment, post: @post, score: -10) }
|
as(@user) { create(:comment, post: @post, score: -10) }
|
||||||
get comments_path(group_by: "post")
|
get comments_path(group_by: "post")
|
||||||
|
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select "#post_#{@post.id}", 1
|
assert_select "#post_#{@post.id}", 1
|
||||||
assert_select "#post_#{@post.id} #show-all-comments-link", 1
|
assert_select "#post_#{@post.id} #show-all-comments-link", /Show 1 hidden comment/
|
||||||
assert_select "#post_#{@post.id} .comment", 0
|
assert_select "#post_#{@post.id} .comment", 0
|
||||||
assert_select "#post_#{@post.id} .list-of-comments", /There are no visible comments/
|
assert_select "#post_#{@post.id} .list-of-comments", /There are no visible comments/
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not show the 'Show all comments' link on posts with deleted comments to Members" do
|
should "not show the 'Show hidden comments' link on posts with deleted comments to Members" do
|
||||||
@comment1 = as(@user) { create(:comment, post: @post) }
|
@comment1 = as(@user) { create(:comment, post: @post) }
|
||||||
@comment2 = as(@user) { create(:comment, post: @post, is_deleted: true) }
|
@comment2 = as(@user) { create(:comment, post: @post, is_deleted: true) }
|
||||||
get comments_path(group_by: "post")
|
get comments_path(group_by: "post")
|
||||||
@@ -57,7 +57,7 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
assert_select "#post_#{@post.id} #show-all-comments-link", 0
|
assert_select "#post_#{@post.id} #show-all-comments-link", 0
|
||||||
end
|
end
|
||||||
|
|
||||||
should "show the 'Show all comments' link on posts with deleted comments to Moderators" do
|
should "show the 'Show hidden comments' link on posts with deleted comments to Moderators" do
|
||||||
@comment1 = as(@user) { create(:comment, post: @post) }
|
@comment1 = as(@user) { create(:comment, post: @post) }
|
||||||
@comment2 = as(@user) { create(:comment, post: @post, is_deleted: true) }
|
@comment2 = as(@user) { create(:comment, post: @post, is_deleted: true) }
|
||||||
get_auth comments_path(group_by: "post"), @mod
|
get_auth comments_path(group_by: "post"), @mod
|
||||||
@@ -65,7 +65,7 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select "#post_#{@post.id}", 1
|
assert_select "#post_#{@post.id}", 1
|
||||||
assert_select "#post_#{@post.id} .comment", 1
|
assert_select "#post_#{@post.id} .comment", 1
|
||||||
assert_select "#post_#{@post.id} #show-all-comments-link", 1
|
assert_select "#post_#{@post.id} #show-all-comments-link", /Show 1 hidden comment/
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not bump posts with nonbumping comments" do
|
should "not bump posts with nonbumping comments" do
|
||||||
|
|||||||
Reference in New Issue
Block a user