Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-25 12:08:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-25 12:08:11 +0300
commit5064bf8c5647d4c4430cbb4d097cf1592416de29 (patch)
treed051bf2abe2cc7061b3a7facb6669a56ccb9cf54 /app/models/commit_status.rb
parent9c83aadd2604e7e6cb1f84683f951e6b12872618 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r--app/models/commit_status.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index 35b727720ba..03260b28335 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -62,13 +62,16 @@ class CommitStatus < ApplicationRecord
preload(project: :namespace)
end
- scope :match_id_and_lock_version, -> (slice) do
+ scope :match_id_and_lock_version, -> (items) do
# it expects that items are an array of attributes to match
# each hash needs to have `id` and `lock_version`
- slice.inject(self) do |relation, item|
- match = CommitStatus.where(item.slice(:id, :lock_version))
+ or_conditions = items.inject(none) do |relation, item|
+ match = CommitStatus.default_scoped.where(item.slice(:id, :lock_version))
+
relation.or(match)
end
+
+ merge(or_conditions)
end
# We use `CommitStatusEnums.failure_reasons` here so that EE can more easily