Files
nairobi/app/controllers/moderation/comments_controller.rb

34 lines
763 B
Ruby

class Moderation::CommentsController < Moderation::BaseController
has_filters %w{all pending_flag_review with_ignored_flag}, only: :index
before_filter :load_comments, only: :index
load_and_authorize_resource
def index
@comments = @comments.send(@current_filter)
@comments = @comments.page(params[:page])
end
def hide
@comment.hide
end
def hide_in_moderation_screen
@comment.hide
redirect_to request.query_parameters.merge(action: :index)
end
def ignore_flag
@comment.ignore_flag
redirect_to request.query_parameters.merge(action: :index)
end
private
def load_comments
@comments = Comment.accessible_by(current_ability, :hide).flagged.sorted_for_moderation.includes(:commentable)
end
end