summaryrefslogtreecommitdiff
path: root/app/services/authorized_project_update
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-19 23:18:09 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-19 23:18:09 +0000
commit6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch)
treedc4d20fe6064752c0bd323187252c77e0a89144b /app/services/authorized_project_update
parent9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff)
downloadgitlab-ce-6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde.tar.gz
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'app/services/authorized_project_update')
-rw-r--r--app/services/authorized_project_update/find_records_due_for_refresh_service.rb32
1 files changed, 17 insertions, 15 deletions
diff --git a/app/services/authorized_project_update/find_records_due_for_refresh_service.rb b/app/services/authorized_project_update/find_records_due_for_refresh_service.rb
index 3a2251f15cc..dd696da0447 100644
--- a/app/services/authorized_project_update/find_records_due_for_refresh_service.rb
+++ b/app/services/authorized_project_update/find_records_due_for_refresh_service.rb
@@ -28,31 +28,33 @@ module AuthorizedProjectUpdate
current.except!(*projects_with_duplicates)
remove |= current.each_with_object([]) do |(project_id, row), array|
+ next if fresh[project_id] && fresh[project_id] == row.access_level
+
# rows not in the new list or with a different access level should be
# removed.
- if !fresh[project_id] || fresh[project_id] != row.access_level
- if incorrect_auth_found_callback
- incorrect_auth_found_callback.call(project_id, row.access_level)
- end
- array << row.project_id
+ if incorrect_auth_found_callback
+ incorrect_auth_found_callback.call(project_id, row.access_level)
end
+
+ array << row.project_id
end
add = fresh.each_with_object([]) do |(project_id, level), array|
+ next if current[project_id] && current[project_id].access_level == level
+
# rows not in the old list or with a different access level should be
# added.
- if !current[project_id] || current[project_id].access_level != level
- if missing_auth_found_callback
- missing_auth_found_callback.call(project_id, level)
- end
-
- array << {
- user_id: user.id,
- project_id: project_id,
- access_level: level
- }
+
+ if missing_auth_found_callback
+ missing_auth_found_callback.call(project_id, level)
end
+
+ array << {
+ user_id: user.id,
+ project_id: project_id,
+ access_level: level
+ }
end
[remove, add]