comments: fixup "show hidden comments" link.

Fixup for 896f144eb.
This commit is contained in:
evazion
2019-09-17 00:28:40 -05:00
parent 793c07341d
commit c85bbbf8c2
2 changed files with 4 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ class CommentsController < ApplicationController
skip_before_action :api_check skip_before_action :api_check
def index def index
params[:group_by] ||= "comment" if params[:search] params[:group_by] ||= "comment" if params[:search].present?
if params[:group_by] == "comment" || request.format == Mime::Type.lookup("application/atom+xml") if params[:group_by] == "comment" || request.format == Mime::Type.lookup("application/atom+xml")
index_by_comment index_by_comment

View File

@@ -21,8 +21,10 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest
context "index action" do context "index action" do
context "grouped by post" do context "grouped by post" do
should "render all comments for .js" do should "render all comments for .js" do
get comments_path(post_id: @post.id, group_by: "post", format: "js"), xhr: true get comments_path(post_id: @post.id), xhr: true
assert_response :success assert_response :success
assert_equal("text/javascript", response.media_type)
end end
should "show posts with visible comments" do should "show posts with visible comments" do