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.

32 lines
764 B

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