diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 15:09:30 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 15:09:30 +0000 |
commit | c6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf (patch) | |
tree | 967afee9a510ff9dd503ebd83706dc760ec2e3ed /app/models/member.rb | |
parent | 903ccf7c93eb9490c76857bffe744249cc07de09 (diff) | |
download | gitlab-ce-c6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/member.rb')
-rw-r--r-- | app/models/member.rb | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/app/models/member.rb b/app/models/member.rb index d7c515b650b..5b33333aa23 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -9,6 +9,7 @@ class Member < ApplicationRecord include Presentable include Gitlab::Utils::StrongMemoize include FromUnion + include UpdateHighestRole attr_accessor :raw_invite_token @@ -100,7 +101,6 @@ class Member < ApplicationRecord after_destroy :destroy_notification_setting after_destroy :post_destroy_hook, unless: :pending? after_commit :refresh_member_authorized_projects - after_commit :update_highest_role default_value_for :notification_level, NotificationSetting.levels[:global] @@ -463,21 +463,15 @@ class Member < ApplicationRecord end end - # Triggers the service to schedule a Sidekiq job to update the highest role - # for a User - # - # The job will be called outside of a transaction in order to ensure the changes - # for a Member to be commited before attempting to update the highest role. - # rubocop: disable CodeReuse/ServiceClass - def update_highest_role + def update_highest_role? return unless user_id.present? - return unless previous_changes[:access_level].present? - run_after_commit_or_now do - Members::UpdateHighestRoleService.new(user_id).execute - end + previous_changes[:access_level].present? + end + + def update_highest_role_attribute + user_id end - # rubocop: enable CodeReuse/ServiceClass end Member.prepend_if_ee('EE::Member') |