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.

29 lines
710 B

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