The code powering m.abunchtell.com https://m.abunchtell.com
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

profiles_controller.rb 835 B

pirms 7 gadiem
123456789101112131415161718192021222324252627282930313233343536
  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, :bot, fields_attributes: [:name, :value])
  23. end
  24. def set_account
  25. @account = current_user.account
  26. end
  27. end