Sha256: da2d9a603ac9e8ead99c393fdec503845b822caec880656cd8dcbf0ab1dbff46
Contents?: true
Size: 793 Bytes
Versions: 13
Compression:
Stored size: 793 Bytes
Contents
# frozen_string_literal: true module Decidim # This command updates the user's notifictions settings. class UpdateNotificationsSettings < Rectify::Command # Updates a user's notifications settings. # # user - The user to be updated. # form - The form with the data. def initialize(user, form) @user = user @form = form end def call return broadcast(:invalid) unless @form.valid? update_notifications_settings @user.save! broadcast(:ok, @user) end private def update_notifications_settings @user.comments_notifications = @form.comments_notifications @user.replies_notifications = @form.replies_notifications @user.newsletter_notifications = @form.newsletter_notifications end end end
Version data entries
13 entries across 13 versions & 2 rubygems