logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

profiles_controller.rb (829B)


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