Move Ci::Build#available_statuses to AVAILABLE_STATUSES constant in CommitStatus
This commit is contained in:
parent
405b82af23
commit
2c7d9cfa7d
3 changed files with 3 additions and 5 deletions
|
@ -97,10 +97,6 @@ module Ci
|
|||
new_build.save
|
||||
new_build
|
||||
end
|
||||
|
||||
def available_statuses
|
||||
state_machines[:status].states.map &:value
|
||||
end
|
||||
end
|
||||
|
||||
state_machine :status, initial: :pending do
|
||||
|
|
|
@ -56,6 +56,8 @@ class CommitStatus < ActiveRecord::Base
|
|||
scope :ordered, -> { order(:ref, :stage_idx, :name) }
|
||||
scope :for_ref, ->(ref) { where(ref: ref) }
|
||||
|
||||
AVAILABLE_STATUSES = ['pending', 'running', 'success', 'failed', 'canceled']
|
||||
|
||||
state_machine :status, initial: :pending do
|
||||
event :run do
|
||||
transition pending: :running
|
||||
|
|
|
@ -125,7 +125,7 @@ module API
|
|||
def filter_builds(builds, scope)
|
||||
return builds if scope.nil? || scope.empty?
|
||||
|
||||
available_statuses = Ci::Build.available_statuses
|
||||
available_statuses = ::CommitStatus::AVAILABLE_STATUSES
|
||||
scope =
|
||||
if scope.is_a?(String)
|
||||
[scope]
|
||||
|
|
Loading…
Reference in a new issue