Class: Decidim::UpdateNotificationsSettings
- Inherits:
-
Command
- Object
- Command
- Decidim::UpdateNotificationsSettings
- Defined in:
- decidim-core/app/commands/decidim/update_notifications_settings.rb
Overview
This command updates the user’s notifications settings.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(user, form) ⇒ UpdateNotificationsSettings
constructor
Updates a user’s notifications settings.
Constructor Details
#initialize(user, form) ⇒ UpdateNotificationsSettings
Updates a user’s notifications settings.
user - The user to be updated. form - The form with the data.
10 11 12 13 |
# File 'decidim-core/app/commands/decidim/update_notifications_settings.rb', line 10 def initialize(user, form) @user = user @form = form end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'decidim-core/app/commands/decidim/update_notifications_settings.rb', line 15 def call return broadcast(:invalid) unless @form.valid? update_notifications_settings @user.save! broadcast(:ok, @user) end |