logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

notifications_controller.rb (717B)


  1. # frozen_string_literal: true
  2. class Settings::NotificationsController < ApplicationController
  3. layout 'admin'
  4. before_action :authenticate_user!
  5. def show; end
  6. def update
  7. user_settings.update(user_settings_params.to_h)
  8. if current_user.save
  9. redirect_to settings_notifications_path, notice: I18n.t('generic.changes_saved_msg')
  10. else
  11. render :show
  12. end
  13. end
  14. private
  15. def user_settings
  16. UserSettingsDecorator.new(current_user)
  17. end
  18. def user_settings_params
  19. params.require(:user).permit(
  20. notification_emails: %i(follow follow_request reblog favourite mention digest),
  21. interactions: %i(must_be_follower must_be_following must_be_following_dm)
  22. )
  23. end
  24. end