2024-02-25 12:15:55 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-02-09 21:42:43 -05:00
|
|
|
class EmailBlacklistsController < ApplicationController
|
2019-11-26 17:03:43 -05:00
|
|
|
respond_to :html, :json, :js
|
2019-02-09 21:42:43 -05:00
|
|
|
before_action :admin_only
|
|
|
|
|
|
|
|
def index
|
|
|
|
@blacklists = EmailBlacklist.search(search_params).paginate(params[:page], limit: params[:limit])
|
|
|
|
respond_with(@blacklists)
|
|
|
|
end
|
|
|
|
|
|
|
|
def new
|
|
|
|
@blacklist = EmailBlacklist.new
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@blacklist = EmailBlacklist.create(blacklist_params)
|
|
|
|
respond_with(@blacklist, location: email_blacklists_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
@blacklist = EmailBlacklist.find(params[:id])
|
|
|
|
@blacklist.destroy
|
|
|
|
respond_with(@blacklist)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def search_params
|
2022-02-06 09:19:08 -05:00
|
|
|
permit_search_params %i[order domain reason]
|
2019-02-09 21:42:43 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def blacklist_params
|
|
|
|
params.require(:email_blacklist).permit(%i[domain reason])
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|