diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-04-24 15:13:26 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-04-24 15:13:26 +0000 |
commit | 0affdb85b1c84d2664da634b5dea86c1be5e8c6a (patch) | |
tree | ef98102098908374bb6b5fef3c0358846e592b30 /app | |
parent | 8e6dabb0118a8245f42974f9e92fe53ccb1c43f2 (diff) | |
parent | ee40ec7ddbfb8b1dfdeec615bae34e5e977c5165 (diff) | |
download | gitlab-ce-0affdb85b1c84d2664da634b5dea86c1be5e8c6a.tar.gz |
Merge branch 'fix/gb/fix-incorrect-commit-status-badge-text' into 'master'
Fix incorrect commit status text on main project page
See merge request !10863
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/ci_status_helper.rb | 25 | ||||
-rw-r--r-- | app/views/projects/_last_commit.html.haml | 3 |
2 files changed, 25 insertions, 3 deletions
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index 2de9e0de310..32b1e7822af 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -1,10 +1,16 @@ +## +# DEPRECATED +# +# These helpers are deprecated in favor of detailed CI/CD statuses. +# +# See 'detailed_status?` method and `Gitlab::Ci::Status` module. +# module CiStatusHelper def ci_status_path(pipeline) project = pipeline.project namespace_project_pipeline_path(project.namespace, project, pipeline) end - # Is used by Commit and Merge Request Widget def ci_label_for_status(status) if detailed_status?(status) return status.label @@ -22,6 +28,23 @@ module CiStatusHelper end end + def ci_text_for_status(status) + if detailed_status?(status) + return status.text + end + + case status + when 'success' + 'passed' + when 'success_with_warnings' + 'passed' + when 'manual' + 'blocked' + else + status + end + end + def ci_status_for_statuseable(subject) status = subject.try(:status) || 'not found' status.humanize diff --git a/app/views/projects/_last_commit.html.haml b/app/views/projects/_last_commit.html.haml index e1fea8ccf3d..df3b1c75508 100644 --- a/app/views/projects/_last_commit.html.haml +++ b/app/views/projects/_last_commit.html.haml @@ -1,10 +1,9 @@ - - ref = local_assigns.fetch(:ref) - status = commit.status(ref) - if status = link_to pipelines_namespace_project_commit_path(commit.project.namespace, commit.project, commit), class: "ci-status ci-#{status}" do = ci_icon_for_status(status) - = ci_label_for_status(status) + = ci_text_for_status(status) = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit_short_id" = link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit), class: "commit-row-message" |