2016-01-09 14:30:34 -05:00
|
|
|
class Admin::SpamLogsController < Admin::ApplicationController
|
|
|
|
def index
|
2016-01-26 16:20:01 -05:00
|
|
|
@spam_logs = SpamLog.order(id: :desc).page(params[:page])
|
2016-01-09 14:30:34 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2016-01-26 16:20:01 -05:00
|
|
|
spam_log = SpamLog.find(params[:id])
|
2016-01-09 14:30:34 -05:00
|
|
|
|
|
|
|
if params[:remove_user]
|
2017-04-16 17:54:41 -04:00
|
|
|
spam_log.remove_user(deleted_by: current_user)
|
2017-06-06 18:45:16 -04:00
|
|
|
redirect_to admin_spam_logs_path,
|
|
|
|
status: 302,
|
|
|
|
notice: "User #{spam_log.user.username} was successfully removed."
|
2016-01-26 16:20:01 -05:00
|
|
|
else
|
|
|
|
spam_log.destroy
|
2016-03-15 21:16:25 -04:00
|
|
|
head :ok
|
2016-01-09 14:30:34 -05:00
|
|
|
end
|
|
|
|
end
|
2016-07-30 00:18:32 -04:00
|
|
|
|
2016-08-01 13:14:03 -04:00
|
|
|
def mark_as_ham
|
2016-07-30 00:18:32 -04:00
|
|
|
spam_log = SpamLog.find(params[:id])
|
|
|
|
|
2016-08-09 13:43:47 -04:00
|
|
|
if HamService.new(spam_log).mark_as_ham!
|
2016-08-01 13:14:03 -04:00
|
|
|
redirect_to admin_spam_logs_path, notice: 'Spam log successfully submitted as ham.'
|
|
|
|
else
|
2016-08-09 13:43:47 -04:00
|
|
|
redirect_to admin_spam_logs_path, alert: 'Error with Akismet. Please check the logs for more info.'
|
2016-08-01 13:14:03 -04:00
|
|
|
end
|
2016-07-30 00:18:32 -04:00
|
|
|
end
|
2016-01-09 14:30:34 -05:00
|
|
|
end
|