Class: Decidim::UnsubscribeSettings
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::UnsubscribeSettings
- Defined in:
- app/commands/decidim/unsubscribe_settings.rb
Overview
This command unsubscribes user from newsletter.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(user) ⇒ UnsubscribeSettings
constructor
unsubscribe user from newsletter.
Constructor Details
#initialize(user) ⇒ UnsubscribeSettings
unsubscribe user from newsletter.
user - The user to be updated. newsletter_notifications_at - to be nil
10 11 12 |
# File 'app/commands/decidim/unsubscribe_settings.rb', line 10 def initialize(user) @user = user end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/commands/decidim/unsubscribe_settings.rb', line 14 def call return broadcast(:invalid) unless @user. update_settings @user.save! broadcast(:ok, @user) end |