diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/pipeline.rb | 4 | ||||
-rw-r--r-- | app/models/commit.rb | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index aa0367227a8..9edfc75eac7 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -98,6 +98,10 @@ module Ci end.where(id: max_id.group(:ref, :sha)) end + def self.latest_status(ref = nil) + latest(ref).status + end + def self.latest_successful_for(ref) success.latest(ref).first end diff --git a/app/models/commit.rb b/app/models/commit.rb index 91c7970fca6..69cfc47f5bf 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -230,7 +230,7 @@ class Commit return @statuses[ref] if @statuses.key?(ref) - @statuses[ref] = pipelines.latest(ref).status + @statuses[ref] = pipelines.latest_status(ref) end def revert_branch_name @@ -266,7 +266,7 @@ class Commit @merged_merge_request_hash ||= Hash.new do |hash, user| hash[user] = merged_merge_request_no_cache(user) end - + @merged_merge_request_hash[current_user] end |