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]
|
2016-01-26 16:20:01 -05:00
|
|
|
spam_log.remove_user
|
|
|
|
redirect_to admin_spam_logs_path, notice: "User #{spam_log.user.username} was successfully removed."
|
|
|
|
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
|