diff --git a/app/controllers/settings/profiles_controller.rb b/app/controllers/settings/profiles_controller.rb index 8b640cdc..69220efd 100644 --- a/app/controllers/settings/profiles_controller.rb +++ b/app/controllers/settings/profiles_controller.rb @@ -16,12 +16,18 @@ class Settings::ProfilesController < Settings::BaseController end def update - if UpdateAccountService.new.call(@account, account_params) - ActivityPub::UpdateDistributionWorker.perform_async(@account.id) - redirect_to settings_profile_path, notice: I18n.t('generic.changes_saved_msg') + # if verified and display_name is different, return flash error and redirect back + if @account.is_verified && @account.display_name != params[:account][:display_name] + flash[:alert] = 'Unable to change Display name for verified account' + redirect_to settings_profile_path else - @account.build_fields - render :show + if UpdateAccountService.new.call(@account, account_params) + ActivityPub::UpdateDistributionWorker.perform_async(@account.id) + redirect_to settings_profile_path, notice: I18n.t('generic.changes_saved_msg') + else + @account.build_fields + render :show + end end end diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml index 970a6b07..3be119e4 100644 --- a/app/views/settings/profiles/show.html.haml +++ b/app/views/settings/profiles/show.html.haml @@ -6,7 +6,12 @@ .fields-row .fields-row__column.fields-group.fields-row__column-6 - = f.input :display_name, wrapper: :with_label, input_html: { maxlength: 30 }, hint: false + - if @account.is_verified + %span Verified accounts cannot changed display names + %br + %br + - else + = f.input :display_name, wrapper: :with_label, input_html: { maxlength: 30 }, hint: false = f.input :note, wrapper: :with_label, input_html: { maxlength: 500 }, hint: false .fields-row