diff options
author | Matija Čupić <matteeyah@gmail.com> | 2019-08-07 00:58:17 +0300 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2019-08-07 01:13:03 +0300 |
commit | 56876070aa8784cabf59dd71433458b0ebeb077e (patch) | |
tree | 06ab548d5c7815f4a1296c0d39b4c7fabf9c9424 /app | |
parent | 2fd73269ef7e7415380478fd50d8288f6899c6f6 (diff) |
Fix nil take regression
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 |