/comments: add vote buttons beneath thumbnails on /comments page.

Also fix an N+1 queries problem.
This commit is contained in:
evazion
2021-11-21 18:04:52 -06:00
parent be5173c8dd
commit 00befc96f0
4 changed files with 3 additions and 12 deletions

View File

@@ -84,11 +84,6 @@ class CommentsController < ApplicationController
@limit = params.fetch(:limit, 20)
@posts = Post.where.not(last_comment_bumped_at: nil).user_tag_match(params[:tags]).reorder("last_comment_bumped_at DESC NULLS LAST").paginate(params[:page], limit: @limit, search_count: params[:search])
if request.format.html?
@posts = @posts.includes(comments: [:creator])
@posts = @posts.includes(comments: [:votes]) if CurrentUser.is_member?
end
respond_with(@posts)
end