diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-01 18:07:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-01 18:07:45 +0300 |
commit | 1219a9dce91f4edbc135dfc08299b4122b4825a8 (patch) | |
tree | e7d12a55d75a2d56e60d9527bef3724e3578866d /app/workers/update_highest_role_worker.rb | |
parent | 1a0d6dbdc2ac3047f4953a359ef27ba6e26074ae (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers/update_highest_role_worker.rb')
-rw-r--r-- | app/workers/update_highest_role_worker.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/workers/update_highest_role_worker.rb b/app/workers/update_highest_role_worker.rb index e62131a77d0..1e2c974b6e5 100644 --- a/app/workers/update_highest_role_worker.rb +++ b/app/workers/update_highest_role_worker.rb @@ -11,9 +11,15 @@ class UpdateHighestRoleWorker # rubocop: disable CodeReuse/ActiveRecord def perform(user_id) - user = User.active.find_by(id: user_id) + user = User.find_by(id: user_id) - Users::UpdateHighestMemberRoleService.new(user).execute if user.present? + return unless user.present? + + if user.active? && user.user_type.nil? && !user.internal? + Users::UpdateHighestMemberRoleService.new(user).execute + else + UserHighestRole.where(user_id: user_id).delete_all + end end # rubocop: enable CodeReuse/ActiveRecord end |