闭社主体 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.

41 lines
876 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. )
  22. end
  23. def user_settings_params
  24. params.require(:user).permit(
  25. :setting_default_privacy,
  26. :setting_boost_modal,
  27. :setting_auto_play_gif,
  28. notification_emails: %i(follow follow_request reblog favourite mention digest),
  29. interactions: %i(must_be_follower must_be_following)
  30. )
  31. end
  32. end