Sha256: 5e96823810bf79f9231487132fa9ba2ecab9106d2ad936f3949bc4ac626a7734
Contents?: true
Size: 921 Bytes
Versions: 10
Compression:
Stored size: 921 Bytes
Contents
# frozen_string_literal: true module Decidim # The controller to handle the user's notifications settings page. class NotificationsSettingsController < Decidim::ApplicationController include Decidim::UserProfile def show enforce_permission_to(:read, :user, current_user:) @notifications_settings = form(NotificationsSettingsForm).from_model(current_user) end def update enforce_permission_to(:update, :user, current_user:) @notifications_settings = form(NotificationsSettingsForm).from_params(params) UpdateNotificationsSettings.call(@notifications_settings) do on(:ok) do flash.now[:notice] = t("notifications_settings.update.success", scope: "decidim") end on(:invalid) do flash.now[:alert] = t("notifications_settings.update.error", scope: "decidim") end end render action: :show end end end
Version data entries
10 entries across 10 versions & 1 rubygems