diff options
author | Stan Hu <stanhu@gmail.com> | 2019-08-06 23:49:25 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-08-06 23:49:25 +0000 |
commit | ee028785a3e4cebf08cc0a9a2ae969c9f67d675a (patch) | |
tree | 06ab548d5c7815f4a1296c0d39b4c7fabf9c9424 /app | |
parent | 2fd73269ef7e7415380478fd50d8288f6899c6f6 (diff) | |
parent | 56876070aa8784cabf59dd71433458b0ebeb077e (diff) | |
download | gitlab-ce-ee028785a3e4cebf08cc0a9a2ae969c9f67d675a.tar.gz |
Merge branch 'mc/bug/nil-take' into 'master'remove-duplicate-issue-boards-from-project-export-page-ce
Fix nil take regression
Closes #65725
See merge request gitlab-org/gitlab-ce!31554
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 33f1077e982..44b6e5a532c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1487,6 +1487,9 @@ class Project < ApplicationRecord end def pipeline_for(ref, sha = nil, id = nil) + sha ||= commit(ref).try(:sha) + return unless sha + if id.present? pipelines_for(ref, sha).find_by(id: id) else @@ -1494,11 +1497,7 @@ class Project < ApplicationRecord end end - def pipelines_for(ref, sha = nil) - sha ||= commit(ref).try(:sha) - - return unless sha - + def pipelines_for(ref, sha) ci_pipelines.order(id: :desc).where(sha: sha, ref: ref) end |