From ee77b101af0bc66ab07aef8faf08cfef058237ab Mon Sep 17 00:00:00 2001 From: evazion Date: Sat, 31 Aug 2019 16:29:20 -0500 Subject: [PATCH] comments: change 'Show all comments' to 'Show N hidden comments'. --- app/views/comments/partials/index/_list.html.erb | 2 +- test/functional/comments_controller_test.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/comments/partials/index/_list.html.erb b/app/views/comments/partials/index/_list.html.erb index 21f3c4690..58c37d7c4 100644 --- a/app/views/comments/partials/index/_list.html.erb +++ b/app/views/comments/partials/index/_list.html.erb @@ -6,7 +6,7 @@
<% if post.comments.hidden(CurrentUser.user).any? || (page == :comments && post.comments.size > 6) %> - <%= 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 %> <% end %>
diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb index 59badcecd..72e79f2e6 100644 --- a/test/functional/comments_controller_test.rb +++ b/test/functional/comments_controller_test.rb @@ -35,18 +35,18 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest assert_select "#post_#{@post.id} #show-all-comments-link", 0 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) } get comments_path(group_by: "post") assert_response :success 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} .list-of-comments", /There are no visible comments/ 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) } @comment2 = as(@user) { create(:comment, post: @post, is_deleted: true) } get comments_path(group_by: "post") @@ -57,7 +57,7 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest assert_select "#post_#{@post.id} #show-all-comments-link", 0 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) } @comment2 = as(@user) { create(:comment, post: @post, is_deleted: true) } get_auth comments_path(group_by: "post"), @mod @@ -65,7 +65,7 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_select "#post_#{@post.id}", 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 should "not bump posts with nonbumping comments" do