diff options
author | Aishwarya Subramanian <asubramanian@gitlab.com> | 2019-08-26 21:27:31 +0530 |
---|---|---|
committer | Aishwarya Subramanian <asubramanian@gitlab.com> | 2019-08-26 21:27:31 +0530 |
commit | 1f6a223828d0bc2933ac24da2bed19adeb951089 (patch) | |
tree | 5e1148e0155752656affadc3260a37b8f9aff87d | |
parent | d98349ed0ae12347d4ec1072178e28774ad8c1eb (diff) | |
download | gitlab-ce-user_name_migration.tar.gz |
Removed after save hook to derive name from fname, lnameuser_name_migration
-rw-r--r-- | app/models/user.rb | 9 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 10 |
2 files changed, 0 insertions, 19 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 36417a66bbe..6107aaa7fca 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -194,7 +194,6 @@ class User < ApplicationRecord before_save :ensure_user_rights_and_limits, if: ->(user) { user.new_record? || user.external_changed? } before_save :skip_reconfirmation!, if: ->(user) { user.email_changed? && user.read_only_attribute?(:email) } before_save :check_for_verified_email, if: ->(user) { user.email_changed? && !user.new_record? } - before_save :update_name_via_first_name_and_last_name before_validation :ensure_namespace_correct before_save :ensure_namespace_correct # in case validation is skipped after_validation :set_username_errors @@ -895,14 +894,6 @@ class User < ApplicationRecord end end - # Every time first/last name is updated, we update name too. - # This is until we completely migrate from name to first/last name - https://gitlab.com/gitlab-org/gitlab-ee/issues/13661 - def update_name_via_first_name_and_last_name - if first_name_changed? || last_name_changed? - write_attribute(:name, "#{read_attribute(:first_name)} #{read_attribute(:last_name)}") - end - end - def projects_limit_left projects_limit - personal_projects_count end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 5ada8a6c4ef..8338d2b5b39 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -698,16 +698,6 @@ describe User do end end - describe '#update_name' do - let(:user) { create(:user) } - - it 'updates name, when first/last name is updated' do - user.update(first_name: 'Shane', last_name: 'Filan') - - expect(user.name).to eq('Shane Filan') - end - end - describe '#highest_role' do let(:user) { create(:user) } |