diff --git a/app/controllers/admin/comments_controller.rb b/app/controllers/admin/comments_controller.rb index 98283ffed..ebe2f1066 100644 --- a/app/controllers/admin/comments_controller.rb +++ b/app/controllers/admin/comments_controller.rb @@ -4,7 +4,7 @@ class Admin::CommentsController < Admin::BaseController before_action :load_comment, only: [:confirm_hide, :restore] def index - @comments = Comment.only_hidden.send(@current_filter).order(hidden_at: :desc).page(params[:page]) + @comments = Comment.only_hidden.with_visible_author.send(@current_filter).order(hidden_at: :desc).page(params[:page]) end def confirm_hide diff --git a/app/models/comment.rb b/app/models/comment.rb index 227448da2..52192cc7f 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -18,10 +18,9 @@ class Comment < ActiveRecord::Base belongs_to :user, -> { with_hidden } scope :recent, -> { order(id: :desc) } - scope :sort_for_moderation, -> { order(flags_count: :desc, updated_at: :desc) } - scope :for_render, -> { with_hidden.includes(user: :organization) } + scope :with_visible_author, -> { joins(:user).where("users.hidden_at IS NULL") } after_create :call_after_commented diff --git a/app/views/admin/comments/index.html.erb b/app/views/admin/comments/index.html.erb index ce4bfa293..2914cf8c5 100644 --- a/app/views/admin/comments/index.html.erb +++ b/app/views/admin/comments/index.html.erb @@ -9,8 +9,12 @@