diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-10-04 07:33:05 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-10-04 07:33:05 +0000 |
commit | 2ee93c486cfbdf5555677d570cc63d1542c159ba (patch) | |
tree | 269fb45d8daf58258be607fab36118ab73590e8e /app/models/merge_request.rb | |
parent | aaa57c9d35b1eb744fca970263220850db06639f (diff) | |
parent | 1f54c9216f178e96010b28a74f04bae5848ef15d (diff) | |
download | gitlab-ce-2ee93c486cfbdf5555677d570cc63d1542c159ba.tar.gz |
Merge branch '36876-mr-show-json-controller-perf-improvements' into 'master'
Reduce method calls while evaluating Projects::MergeRequestsController#show.json
See merge request gitlab-org/gitlab-ce!14285
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r-- | app/models/merge_request.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index e85b83daf9e..3cb6913549d 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -742,10 +742,9 @@ class MergeRequest < ActiveRecord::Base end def has_ci? - has_ci_integration = source_project.try(:ci_service) - uses_gitlab_ci = all_pipelines.any? + return false if has_no_commits? - (has_ci_integration || uses_gitlab_ci) && commits.any? + !!(head_pipeline_id || all_pipelines.any? || source_project&.ci_service) end def branch_missing? |