Skip to content
Snippets Groups Projects
Commit 2c7d9cfa authored by Tomasz Maczukin's avatar Tomasz Maczukin
Browse files

Move Ci::Build#available_statuses to AVAILABLE_STATUSES constant in CommitStatus

parent 405b82af
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment