From 69c04498ef0a49186a667fd44383b9b43690a91e Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Mon, 12 Oct 2015 15:45:46 +0200 Subject: Small bug fixes --- app/models/commit_status.rb | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'app/models/commit_status.rb') diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index a4896a76316..b6234c896e3 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -11,14 +11,14 @@ class CommitStatus < ActiveRecord::Base alias_attribute :author, :user - scope :running, ->() { where(status: 'running') } - scope :pending, ->() { where(status: 'pending') } - scope :success, ->() { where(status: 'success') } - scope :failed, ->() { where(status: 'failed') } - scope :running_or_pending, ->() { where(status:[:running, :pending]) } - scope :latest, ->() { where(id: unscope(:select).select('max(id)').group(:name, :ref)).order(stage_idx: :asc) } + scope :running, -> { where(status: 'running') } + scope :pending, -> { where(status: 'pending') } + scope :success, -> { where(status: 'success') } + scope :failed, -> { where(status: 'failed') } + scope :running_or_pending, -> { where(status:[:running, :pending]) } + scope :latest, -> { where(id: unscope(:select).select('max(id)').group(:name, :ref)).order(stage_idx: :asc) } scope :for_ref, ->(ref) { where(ref: [ref, nil]) } - scope :running_or_pending, ->() { where(status: [:running, :pending]) } + scope :running_or_pending, -> { where(status: [:running, :pending]) } state_machine :status, initial: :pending do event :run do @@ -55,6 +55,7 @@ class CommitStatus < ActiveRecord::Base delegate :sha, :short_sha, :gl_project, to: :commit, prefix: false + # TODO: this should be removed with all references def before_sha Gitlab::Git::BLANK_SHA end @@ -78,4 +79,12 @@ class CommitStatus < ActiveRecord::Base Time.now - started_at end end + + def cancel_url + nil + end + + def retry_url + nil + end end -- cgit v1.2.1