discourse/app/controllers/admin/flags_controller.rb
Neil Lalonde 4fd5087f91 Add button to delete a spammer in the flag modal
Add SiteSettings: delete_user_max_age, delete_all_posts_max. Add delete spammer button to admin flags UI
Moderators can delete users too
2013-07-29 15:29:44 -04:00

35 lines
845 B
Ruby

class Admin::FlagsController < Admin::AdminController
def index
# we may get out of sync, fix it here
PostAction.update_flagged_posts_count
posts, users = PostAction.flagged_posts_report(params[:filter])
if posts.blank?
render json: {users: [], posts: []}
else
render json: MultiJson.dump({users: serialize_data(users, AdminDetailedUserSerializer), posts: posts})
end
end
def disagree
p = Post.find(params[:id])
PostAction.clear_flags!(p, current_user.id)
p.reload
p.unhide!
render nothing: true
end
def agree
p = Post.find(params[:id])
PostAction.defer_flags!(p, current_user.id)
PostAction.hide_post!(p)
render nothing: true
end
def defer
p = Post.find(params[:id])
PostAction.defer_flags!(p, current_user.id)
render nothing: true
end
end