gitlab-org--gitlab-foss/app/controllers/admin/spam_logs_controller.rb
Stan Hu d20e75a8d8 Support Akismet spam checking for creation of issues via API
Currently any spam detected by Akismet by non-members via API will be logged
in a separate table in the admin page.

Closes #5612
2016-02-02 11:25:44 -02:00

33 lines
748 B
Ruby

class Admin::SpamLogsController < Admin::ApplicationController
before_action :set_spam_log, only: [:destroy]
def index
@spam_logs = SpamLog.order(created_at: :desc).page(params[:page])
end
def destroy
@spam_log.destroy
message = 'Spam log was successfully destroyed.'
if params[:remove_user]
username = @spam_log.user.username
@spam_log.user.destroy
message = "User #{username} was successfully destroyed."
end
respond_to do |format|
format.json { render json: '{}' }
format.html { redirect_to admin_spam_logs_path, notice: message }
end
end
private
def set_spam_log
@spam_log = SpamLog.find(params[:id])
end
def spam_log_params
params[:spam_log]
end
end