Sha256: e92abfd5c9d730d52ce435fb1635ac3b55454559c9fa18dc78bc183794870d7c
Contents?: true
Size: 854 Bytes
Versions: 9
Compression:
Stored size: 854 Bytes
Contents
# frozen_string_literal: true module Decidim # This command updates the user's notifications 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.email_on_notification = @form.email_on_notification @user.newsletter_notifications_at = @form.newsletter_notifications_at @user.notification_types = @form.notification_types @user.direct_message_types = @form.direct_message_types end end end
Version data entries
9 entries across 9 versions & 1 rubygems