Adds first version of comment moderation
Missing: * Ensure removing a flag updates the flagged_at attribute correctly * Showing the debate when the comment is not a “root” * Filter (pending / reviewed / all) * Order * Same for debates
This commit is contained in:
@@ -1,8 +1,31 @@
|
||||
class Moderation::CommentsController < Moderation::BaseController
|
||||
|
||||
before_filter :load_comments, only: :index
|
||||
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
@comments = @comments.page(params[:page])
|
||||
end
|
||||
|
||||
def hide
|
||||
@comment = Comment.find(params[:id])
|
||||
@comment.hide
|
||||
end
|
||||
|
||||
end
|
||||
def hide_in_moderation_screen
|
||||
@comment.hide
|
||||
redirect_to action: :index
|
||||
end
|
||||
|
||||
def mark_as_reviewed
|
||||
@comment.mark_as_reviewed
|
||||
redirect_to action: :index
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_comments
|
||||
@comments = Comment.accessible_by(current_ability, :hide).where('inappropiate_flags_count > 0').includes(:commentable)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user