privacy_controller.rb 727 B

123456789101112131415161718192021222324252627
  1. # frozen_string_literal: true
  2. class Settings::PrivacyController < Settings::BaseController
  3. before_action :set_account
  4. def show; end
  5. def update
  6. if UpdateAccountService.new.call(@account, account_params.except(:settings))
  7. current_user.update!(settings_attributes: account_params[:settings])
  8. ActivityPub::UpdateDistributionWorker.perform_async(@account.id)
  9. redirect_to settings_privacy_path, notice: I18n.t('generic.changes_saved_msg')
  10. else
  11. render :show
  12. end
  13. end
  14. private
  15. def account_params
  16. params.require(:account).permit(:discoverable, :unlocked, :indexable, :show_collections, settings: UserSettings.keys)
  17. end
  18. def set_account
  19. @account = current_account
  20. end
  21. end