23 lines
576 B
Ruby
23 lines
576 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
class Settings::Contacts::SecurityNotificationSwitchesController \
|
||
|
< ApplicationController
|
||
|
before_action :set_contact
|
||
|
|
||
|
# POST /settings/contacts/:contact_id/security_notification_switch
|
||
|
def create
|
||
|
authorize [:settings, ContactSecurityNotificationSwitch.new(@contact)]
|
||
|
|
||
|
@contact.send_security_notifications = !@contact.send_security_notifications
|
||
|
@contact.save!
|
||
|
|
||
|
redirect_to settings_contacts_url
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def set_contact
|
||
|
@contact = current_account&.contact_list&.contacts&.find params[:contact_id]
|
||
|
end
|
||
|
end
|