summaryrefslogtreecommitdiff
path: root/app/workers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-01 15:07:45 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-01 15:07:45 +0000
commit1219a9dce91f4edbc135dfc08299b4122b4825a8 (patch)
treee7d12a55d75a2d56e60d9527bef3724e3578866d /app/workers
parent1a0d6dbdc2ac3047f4953a359ef27ba6e26074ae (diff)
downloadgitlab-ce-1219a9dce91f4edbc135dfc08299b4122b4825a8.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/update_highest_role_worker.rb10
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