diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-12 18:09:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-12 18:09:58 +0300 |
commit | dc250651ab26bf7bce9205d5fa4a45dd58e2df81 (patch) | |
tree | 5d20546877fcc4f36897d4efebb96859e488f1b9 /app/models | |
parent | 2fe5ea34a5f63661a050404d3b5fbe3056a39765 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/build.rb | 2 | ||||
-rw-r--r-- | app/models/integration.rb | 2 | ||||
-rw-r--r-- | app/models/namespaces/traversal/linear.rb | 4 | ||||
-rw-r--r-- | app/models/project.rb | 4 |
4 files changed, 3 insertions, 9 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 5cc8474b71d..7758620f605 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -891,7 +891,7 @@ module Ci end def valid_dependency? - return false if artifacts_expired? + return false if artifacts_expired? && !pipeline.artifacts_locked? return false if erased? true diff --git a/app/models/integration.rb b/app/models/integration.rb index a9c865569d0..5c4d03f1fa8 100644 --- a/app/models/integration.rb +++ b/app/models/integration.rb @@ -274,7 +274,7 @@ class Integration < ApplicationRecord end def self.closest_group_integration(type, scope) - group_ids = scope.ancestors(hierarchy_order: :asc).select(:id) + group_ids = scope.ancestors.select(:id) array = group_ids.to_sql.present? ? "array(#{group_ids.to_sql})" : 'ARRAY[]' where(type: type, group_id: group_ids, inherit_from_id: nil) diff --git a/app/models/namespaces/traversal/linear.rb b/app/models/namespaces/traversal/linear.rb index 3216ec42427..081e51c1028 100644 --- a/app/models/namespaces/traversal/linear.rb +++ b/app/models/namespaces/traversal/linear.rb @@ -178,10 +178,6 @@ module Namespaces depth_sql = "ABS(#{traversal_ids.count} - array_length(traversal_ids, 1))" skope = skope.select(skope.arel_table[Arel.star], "#{depth_sql} as depth") .order(depth: hierarchy_order) - # The SELECT includes an extra depth attribute. We then wrap the SQL - # in a standard SELECT to avoid mismatched attribute errors when - # trying to chain future ActiveRelation commands. - skope = self.class.without_sti_condition.from(skope, self.class.table_name) end skope diff --git a/app/models/project.rb b/app/models/project.rb index 9f90cef9c12..85bb1dea48f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -914,9 +914,7 @@ class Project < ApplicationRecord .base_and_ancestors(upto: top, hierarchy_order: hierarchy_order) end - def ancestors(hierarchy_order: nil) - namespace&.self_and_ancestors(hierarchy_order: hierarchy_order) - end + alias_method :ancestors, :ancestors_upto def ancestors_upto_ids(...) ancestors_upto(...).pluck(:id) |