summaryrefslogtreecommitdiff
path: root/app/models/commit_status.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-10-12 15:45:46 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2015-10-12 15:55:12 +0200
commit69c04498ef0a49186a667fd44383b9b43690a91e (patch)
treee258463d00c42f296d4048f44b8743eb98161567 /app/models/commit_status.rb
parent0aefeeb882b40d740b80f15ac6610a88a340d30b (diff)
downloadgitlab-ce-69c04498ef0a49186a667fd44383b9b43690a91e.tar.gz
Small bug fixes
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r--app/models/commit_status.rb23
1 files changed, 16 insertions, 7 deletions
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