summaryrefslogtreecommitdiff
path: root/app/models/commit_status.rb
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <mail@zjvandeweg.nl>2015-11-11 13:22:00 +0100
committerZeger-Jan van de Weg <mail@zjvandeweg.nl>2015-11-11 13:22:00 +0100
commit9f548dffc33158adb02ef1ec9a6e98b3d090f22b (patch)
tree39f5619db8f33c70dcdf52dbc8d07b3cb8486e59 /app/models/commit_status.rb
parent8db063b579322238af43f6d04b5968d9c6ea935d (diff)
parentdfa09789061bbd3891c17ebbcc23f7bd6b95336c (diff)
downloadgitlab-ce-9f548dffc33158adb02ef1ec9a6e98b3d090f22b.tar.gz
Merge branch 'master' into rake-tasks-git
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r--app/models/commit_status.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index b4d91b1b0c3..7d54d83974a 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -15,11 +15,11 @@ class CommitStatus < ActiveRecord::Base
scope :pending, -> { where(status: 'pending') }
scope :success, -> { where(status: 'success') }
scope :failed, -> { where(status: 'failed') }
- scope :running_or_pending, -> { where(status:[:running, :pending]) }
+ scope :running_or_pending, -> { where(status: [:running, :pending]) }
+ scope :finished, -> { where(status: [:success, :failed, :canceled]) }
scope :latest, -> { where(id: unscope(:select).select('max(id)').group(:name, :ref)) }
scope :ordered, -> { order(:ref, :stage_idx, :name) }
scope :for_ref, ->(ref) { where(ref: ref) }
- scope :running_or_pending, -> { where(status: [:running, :pending]) }
state_machine :status, initial: :pending do
event :run do
@@ -27,7 +27,7 @@ class CommitStatus < ActiveRecord::Base
end
event :drop do
- transition running: :failed
+ transition [:pending, :running] => :failed
end
event :success do
@@ -88,4 +88,8 @@ class CommitStatus < ActiveRecord::Base
def retry_url
nil
end
+
+ def show_warning?
+ false
+ end
end