1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/controllers/settings/contacts/security_notification_switches_controller.rb

22 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