From 057c0d7a5c062f3030bcc46614ef2442009002de Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 6 Apr 2017 21:32:56 +0800 Subject: Also track auto-cancelling in jobs, detail: Not only tracking auto-cancelling in pipelines, we'll also track this in jobs because pipelines could be retried and the information would get lost when this happened. Also erase auto-cancelling relation for pipelines when they're retried. --- app/models/commit_status.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/models/commit_status.rb') diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 17b322b5ae3..2c4033146bf 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -7,6 +7,7 @@ class CommitStatus < ActiveRecord::Base belongs_to :project belongs_to :pipeline, class_name: 'Ci::Pipeline', foreign_key: :commit_id + belongs_to :auto_canceled_by, class_name: 'Ci::Pipeline' belongs_to :user delegate :commit, to: :pipeline @@ -137,6 +138,10 @@ class CommitStatus < ActiveRecord::Base false end + def auto_canceled? + canceled? && auto_canceled_by_id? + end + # Added in 9.0 to keep backward compatibility for projects exported in 8.17 # and prior. def gl_project_id -- cgit v1.2.1