闭社主体 forked from https://github.com/tootsuite/mastodon
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.

42 lines
905 B

  1. # frozen_string_literal: true
  2. class Settings::PreferencesController < 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.update(user_params)
  9. redirect_to settings_preferences_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_params
  19. params.require(:user).permit(
  20. :locale,
  21. allowed_languages: []
  22. )
  23. end
  24. def user_settings_params
  25. params.require(:user).permit(
  26. :setting_default_privacy,
  27. :setting_boost_modal,
  28. :setting_auto_play_gif,
  29. notification_emails: %i(follow follow_request reblog favourite mention digest),
  30. interactions: %i(must_be_follower must_be_following)
  31. )
  32. end
  33. end