gitlab-org--gitlab-foss/app/presenters/ci/build_presenter.rb
Lin Jen-Shin 34eea29511 Fix test and only show job status title if it's
cancelled and the pipeline is auto-cancelled.
2017-04-05 23:33:19 +08:00

21 lines
527 B
Ruby

module Ci
class BuildPresenter < Gitlab::View::Presenter::Delegated
presents :build
def erased_by_user?
# Build can be erased through API, therefore it does not have
# `erased_by` user assigned in that case.
erased? && erased_by
end
def erased_by_name
erased_by.name if erased_by_user?
end
def status_title
if canceled? && pipeline.auto_canceled?
"Job is redundant and is auto-canceled by Pipeline ##{pipeline.auto_canceled_by_id}"
end
end
end
end