You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
727 B

  1. # frozen_string_literal: true
  2. class Settings::NotificationsController < Settings::BaseController
  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 report),
  21. interactions: %i(must_be_follower must_be_following must_be_following_dm)
  22. )
  23. end
  24. end