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.

34 lines
822 B

  1. # frozen_string_literal: true
  2. class Settings::ProfilesController < Settings::BaseController
  3. include ObfuscateFilename
  4. before_action :set_account
  5. obfuscate_filename [:account, :avatar]
  6. obfuscate_filename [:account, :header]
  7. def show
  8. @account.build_fields
  9. end
  10. def update
  11. if UpdateAccountService.new.call(@account, account_params)
  12. ActivityPub::UpdateDistributionWorker.perform_async(@account.id)
  13. redirect_to settings_profile_path, notice: I18n.t('generic.changes_saved_msg')
  14. else
  15. @account.build_fields
  16. render :show
  17. end
  18. end
  19. private
  20. def account_params
  21. params.require(:account).permit(:display_name, :note, :avatar, :header, :locked, :bot, :discoverable, fields_attributes: [:name, :value])
  22. end
  23. def set_account
  24. @account = current_account
  25. end
  26. end