diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-20 21:08:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-20 21:08:51 +0300 |
commit | df2eda3f14dccb703bd7054d4ddde7803cb1fe7e (patch) | |
tree | 0200bb0def01cde22da3bc4c9ed0a7b0f91d6b50 /app/models | |
parent | b9bac6dbf78a5a7976fba14aaeef96bdeb0da612 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/build.rb | 6 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 4 | ||||
-rw-r--r-- | app/models/concerns/with_uploads.rb | 1 | ||||
-rw-r--r-- | app/models/merge_request.rb | 11 |
4 files changed, 16 insertions, 6 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index e95e2c538c5..d61f0bbfb10 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -173,8 +173,10 @@ module Ci scope :queued_before, ->(time) { where(arel_table[:queued_at].lt(time)) } scope :order_id_desc, -> { order('ci_builds.id DESC') } - PROJECT_ROUTE_AND_NAMESPACE_ROUTE = { project: [:project_feature, :route, { namespace: :route }] }.freeze - scope :preload_project_and_pipeline_project, -> { preload(PROJECT_ROUTE_AND_NAMESPACE_ROUTE, pipeline: PROJECT_ROUTE_AND_NAMESPACE_ROUTE) } + scope :preload_project_and_pipeline_project, -> do + preload(Ci::Pipeline::PROJECT_ROUTE_AND_NAMESPACE_ROUTE, + pipeline: Ci::Pipeline::PROJECT_ROUTE_AND_NAMESPACE_ROUTE) + end acts_as_taggable diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 3209e077a08..4ae64b6c8f1 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -16,6 +16,10 @@ module Ci include FromUnion include UpdatedAtFilterable + PROJECT_ROUTE_AND_NAMESPACE_ROUTE = { + project: [:project_feature, :route, { namespace: :route }] + }.freeze + BridgeStatusError = Class.new(StandardError) sha_attribute :source_sha diff --git a/app/models/concerns/with_uploads.rb b/app/models/concerns/with_uploads.rb index 6c6febd186c..d90f32d8b1c 100644 --- a/app/models/concerns/with_uploads.rb +++ b/app/models/concerns/with_uploads.rb @@ -18,7 +18,6 @@ module WithUploads extend ActiveSupport::Concern include FastDestroyAll::Helpers - include FeatureGate # Currently there is no simple way how to select only not-mounted # uploads, it should be all FileUploaders so we select them by diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 5dda1bd8cc7..0bc4e550678 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -235,12 +235,17 @@ class MergeRequest < ApplicationRecord end scope :join_project, -> { joins(:target_project) } scope :references_project, -> { references(:target_project) } + + PROJECT_ROUTE_AND_NAMESPACE_ROUTE = [ + target_project: [:route, { namespace: :route }], + source_project: [:route, { namespace: :route }] + ].freeze + scope :with_api_entity_associations, -> { preload(:assignees, :author, :unresolved_notes, :labels, :milestone, :timelogs, :latest_merge_request_diff, - metrics: [:latest_closed_by, :merged_by], - target_project: [:route, { namespace: :route }], - source_project: [:route, { namespace: :route }]) + *PROJECT_ROUTE_AND_NAMESPACE_ROUTE, + metrics: [:latest_closed_by, :merged_by]) } scope :by_target_branch_wildcard, ->(wildcard_branch_name) do where("target_branch LIKE ?", ApplicationRecord.sanitize_sql_like(wildcard_branch_name).tr('*', '%')) |