2013-02-05 14:16:51 -05:00
|
|
|
class Admin::FlagsController < Admin::AdminController
|
2013-02-07 10:45:24 -05:00
|
|
|
def index
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2013-05-12 21:09:03 -04:00
|
|
|
# we may get out of sync, fix it here
|
|
|
|
PostAction.update_flagged_posts_count
|
2013-05-29 16:49:34 -04:00
|
|
|
posts, users = PostAction.flagged_posts_report(params[:filter])
|
2013-05-12 21:09:03 -04:00
|
|
|
|
2013-05-29 16:49:34 -04:00
|
|
|
if posts.blank?
|
2013-03-22 14:08:11 -04:00
|
|
|
render json: {users: [], posts: []}
|
2013-02-05 14:16:51 -05:00
|
|
|
else
|
2013-05-29 16:49:34 -04:00
|
|
|
render json: MultiJson.dump({users: serialize_data(users, BasicUserSerializer), posts: posts})
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def clear
|
|
|
|
p = Post.find(params[:id])
|
|
|
|
PostAction.clear_flags!(p, current_user.id)
|
2013-05-24 16:03:20 -04:00
|
|
|
p.reload
|
|
|
|
p.unhide!
|
2013-02-07 10:45:24 -05:00
|
|
|
render nothing: true
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
end
|