comments: rework thresholded comments.
Previously thresholded comments were hidden completely. You had to click the "Show X hidden comments" button to unhide all hidden comments in a thread. Now it works like this: * When a comment is below your threshold, the comment text is hidden and replaced by a `[hidden]` link, which you can click to unhide the comment. * When a comment is at half your threshold (for example, your threshold is -8 but the comment is at -4), then the comment is greyed out. This means that comments aren't completely hidden, they're just collapsed, so you can see the commenter and the score without unhiding the comment. It also means you don't have to scroll back up to unhide a comment, and threads aren't disrupted by comments being secretly hidden (which is confusing when people are replying to hidden comments, which forces you to go back up and unhide to find).
This commit is contained in:
@@ -560,58 +560,6 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
end
|
||||
|
||||
context "with only deleted comments" do
|
||||
setup do
|
||||
as(@user) { create(:comment, creator: @user, post: @post, is_deleted: true) }
|
||||
end
|
||||
|
||||
should "not show deleted comments to regular members" do
|
||||
get_auth post_path(@post), @user, params: { id: @post.id }
|
||||
|
||||
assert_response :success
|
||||
assert_select "article.comment", 0
|
||||
assert_select "a#show-all-comments-link", 0
|
||||
assert_select "div.list-of-comments p", /There are no comments/
|
||||
end
|
||||
|
||||
should "not show deleted comments to moderators by default, but allow them to be unhidden" do
|
||||
mod = create(:mod_user)
|
||||
get_auth post_path(@post), mod, params: { id: @post.id }
|
||||
|
||||
assert_response :success
|
||||
assert_select "article.comment", 0
|
||||
assert_select "a#show-all-comments-link", 1
|
||||
assert_select "div.list-of-comments p", /There are no comments/
|
||||
end
|
||||
end
|
||||
|
||||
context "with only downvoted comments" do
|
||||
should "not show thresholded comments" do
|
||||
comment = as(@user) { create(:comment, creator: @user, post: @post, score: -10) }
|
||||
get_auth post_path(@post), @user, params: { id: @post.id }
|
||||
|
||||
assert_response :success
|
||||
assert_select "article.comment", 0
|
||||
assert_select "a#show-all-comments-link", 1
|
||||
assert_select "div.list-of-comments p", /There are no visible comments/
|
||||
end
|
||||
end
|
||||
|
||||
context "with a mix of comments" do
|
||||
should "not show deleted or thresholded comments " do
|
||||
as(@user) { create(:comment, creator: @user, post: @post, do_not_bump_post: true, body: "good") }
|
||||
as(@user) { create(:comment, creator: @user, post: @post, do_not_bump_post: true, body: "bad", score: -10) }
|
||||
as(@user) { create(:comment, creator: @user, post: @post, do_not_bump_post: true, body: "ugly", is_deleted: true) }
|
||||
|
||||
get_auth post_path(@post), @user, params: { id: @post.id }
|
||||
|
||||
assert_response :success
|
||||
assert_select "article.comment", 1
|
||||
assert_select "article.comment", /good/
|
||||
assert_select "a#show-all-comments-link", 1
|
||||
end
|
||||
end
|
||||
|
||||
context "when the recommend service is enabled" do
|
||||
setup do
|
||||
@post2 = create(:post)
|
||||
|
||||
Reference in New Issue
Block a user