summaryrefslogtreecommitdiff
path: root/app/presenters
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2018-05-16 15:58:20 -0500
committerMayra Cabrera <mcabrera@gitlab.com>2018-05-16 15:59:51 -0500
commitf494f2711a5a19b751c50832d8ae15c01ce3c3ee (patch)
tree17818ce6c92cb0af8be4b45e313c47c2e7fd1ae7 /app/presenters
parent86ef8221778d2aff630feecfa15ba70514983dbc (diff)
downloadgitlab-ce-f494f2711a5a19b751c50832d8ae15c01ce3c3ee.tar.gz
Respect the inheritance chain between Ci::Build and CommitStatus46177-fix-present-on-generic-commit-status
Also moves the assertions were they belong
Diffstat (limited to 'app/presenters')
-rw-r--r--app/presenters/ci/build_presenter.rb25
-rw-r--r--app/presenters/commit_status_presenter.rb24
2 files changed, 24 insertions, 25 deletions
diff --git a/app/presenters/ci/build_presenter.rb b/app/presenters/ci/build_presenter.rb
index 4873d7ce662..e0aaa5cb736 100644
--- a/app/presenters/ci/build_presenter.rb
+++ b/app/presenters/ci/build_presenter.rb
@@ -1,16 +1,5 @@
module Ci
- class BuildPresenter < Gitlab::View::Presenter::Delegated
- CALLOUT_FAILURE_MESSAGES = {
- unknown_failure: 'There is an unknown failure, please try again',
- script_failure: 'There has been a script failure. Check the job log for more information',
- api_failure: 'There has been an API failure, please try again',
- stuck_or_timeout_failure: 'There has been a timeout failure or the job got stuck. Check your timeout limits or try again',
- runner_system_failure: 'There has been a runner system failure, please try again',
- missing_dependency_failure: 'There has been a missing dependency failure, check the job log for more information'
- }.freeze
-
- presents :build
-
+ class BuildPresenter < CommitStatusPresenter
def erased_by_user?
# Build can be erased through API, therefore it does not have
# `erased_by` user assigned in that case.
@@ -44,14 +33,6 @@ module Ci
"#{subject.name} - #{detailed_status.status_tooltip}"
end
- def callout_failure_message
- CALLOUT_FAILURE_MESSAGES[failure_reason.to_sym]
- end
-
- def recoverable?
- failed? && !unrecoverable?
- end
-
private
def tooltip_for_badge
@@ -61,9 +42,5 @@ module Ci
def detailed_status
@detailed_status ||= subject.detailed_status(user)
end
-
- def unrecoverable?
- script_failure? || missing_dependency_failure?
- end
end
end
diff --git a/app/presenters/commit_status_presenter.rb b/app/presenters/commit_status_presenter.rb
index 028deaf235c..c7f7aa836bd 100644
--- a/app/presenters/commit_status_presenter.rb
+++ b/app/presenters/commit_status_presenter.rb
@@ -1,2 +1,24 @@
-class CommitStatusPresenter < Ci::BuildPresenter
+class CommitStatusPresenter < Gitlab::View::Presenter::Delegated
+ CALLOUT_FAILURE_MESSAGES = {
+ unknown_failure: 'There is an unknown failure, please try again',
+ script_failure: 'There has been a script failure. Check the job log for more information',
+ api_failure: 'There has been an API failure, please try again',
+ stuck_or_timeout_failure: 'There has been a timeout failure or the job got stuck. Check your timeout limits or try again',
+ runner_system_failure: 'There has been a runner system failure, please try again',
+ missing_dependency_failure: 'There has been a missing dependency failure, check the job log for more information'
+ }.freeze
+
+ presents :build
+
+ def callout_failure_message
+ CALLOUT_FAILURE_MESSAGES[failure_reason.to_sym]
+ end
+
+ def recoverable?
+ failed? && !unrecoverable?
+ end
+
+ def unrecoverable?
+ script_failure? || missing_dependency_failure?
+ end
end