diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-06-26 14:42:44 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-06-26 14:42:44 +0300 |
commit | bff82b784bac7af8cf3a3d8b49fa10ebd1ef67f0 (patch) | |
tree | 2b294a4f5f947843ea6afdb8f31338e2901f5e8f /app/models | |
parent | 739a03a825e5c04c7566bc3bb26314b049e403ec (diff) | |
parent | 4d70c479107fc502668a83fc369159062d8efbb8 (diff) |
Merge branch 'feature/add-new-services' into 'master'
Add additional user and email services
See merge request !12125
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 9971e43146a..650b64e7551 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -53,7 +53,7 @@ class User < ActiveRecord::Base lease = Gitlab::ExclusiveLease.new("user_update_tracked_fields:#{id}", timeout: 1.hour.to_i) return unless lease.try_obtain - save(validate: false) + Users::UpdateService.new(self).execute(validate: false) end attr_accessor :force_random_password @@ -494,10 +494,8 @@ class User < ActiveRecord::Base def update_emails_with_primary_email primary_email_record = emails.find_by(email: email) if primary_email_record - primary_email_record.destroy - emails.create(email: email_was) - - update_secondary_emails! + Emails::DestroyService.new(self, email: email).execute + Emails::CreateService.new(self, email: email_was).execute end end @@ -965,7 +963,7 @@ class User < ActiveRecord::Base if attempts_exceeded? lock_access! unless access_locked? else - save(validate: false) + Users::UpdateService.new(self).execute(validate: false) end end @@ -1129,7 +1127,8 @@ class User < ActiveRecord::Base email: email, &creation_block ) - user.save(validate: false) + + Users::UpdateService.new(user).execute(validate: false) user ensure Gitlab::ExclusiveLease.cancel(lease_key, uuid) |