diff options
author | Andreas Kämmerle <andreas.kaemmerle@gmail.com> | 2018-07-03 15:30:36 +0200 |
---|---|---|
committer | Andreas Kämmerle <andreas.kaemmerle@gmail.com> | 2018-07-03 15:30:36 +0200 |
commit | e4a310113a3a5784be863151e5bcecacb23aa244 (patch) | |
tree | 79f9019b2e001a192eae3569b5746ba9c4ec9476 /app/models/commit_status.rb | |
parent | d505b48806c0880ac810374973c4b9ba802c26e8 (diff) | |
parent | c489d53b2e2eecb22f8dc7034da142221220e89f (diff) | |
download | gitlab-ce-e4a310113a3a5784be863151e5bcecacb23aa244.tar.gz |
Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into update-template-name-via-sentence-case
# Conflicts:
# .gitlab/issue_templates/Feature proposal.md
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r-- | app/models/commit_status.rb | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index a7d05722287..97516079b66 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -3,6 +3,7 @@ class CommitStatus < ActiveRecord::Base include Importable include AfterCommitQueue include Presentable + include EnumWithNil self.table_name = 'ci_builds' @@ -39,7 +40,7 @@ class CommitStatus < ActiveRecord::Base scope :retried_ordered, -> { retried.ordered.includes(project: :namespace) } scope :after_stage, -> (index) { where('stage_idx > ?', index) } - enum failure_reason: { + enum_with_nil failure_reason: { unknown_failure: nil, script_failure: 1, api_failure: 2, @@ -190,11 +191,4 @@ class CommitStatus < ActiveRecord::Base v =~ /\d+/ ? v.to_i : v end end - - # Rails 5.0 autogenerated question mark enum methods return wrong result if enum value is nil. - # They always return `false`. - # This method overwrites the autogenerated one to return correct result. - def unknown_failure? - Gitlab.rails5? ? failure_reason.nil? : super - end end |