diff options
| author | Grzegorz Bizon <grzegorz.bizon@ntsn.pl> | 2015-12-14 11:28:49 +0100 |
|---|---|---|
| committer | Grzegorz Bizon <grzegorz.bizon@ntsn.pl> | 2015-12-14 11:28:49 +0100 |
| commit | b8f67c5e4735eb25a3d03daeb95900dc87692123 (patch) | |
| tree | ef00cb4394ca45563636fd49b5a9378f117e9d49 /app | |
| parent | 2dafec91dd542ac641fea4750bf8fd68211a58af (diff) | |
| download | gitlab-ce-b8f67c5e4735eb25a3d03daeb95900dc87692123.tar.gz | |
Do not display ci build status if builds enabled but no `.gitlab-ci.yml`
Ref #3827
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/ci/commit.rb | 10 | ||||
| -rw-r--r-- | app/views/projects/commit/_commit_box.html.haml | 2 | ||||
| -rw-r--r-- | app/views/projects/commits/_commit.html.haml | 4 |
3 files changed, 13 insertions, 3 deletions
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb index 75465685e98..fca18ba79be 100644 --- a/app/models/ci/commit.rb +++ b/app/models/ci/commit.rb @@ -220,6 +220,16 @@ module Ci update!(committed_at: DateTime.now) end + ## + # This method checks if build status should be displayed. + # + # Build status should be available only if builds are enabled + # on project level and `.gitlab-ci.yml` file is present. + # + def show_build_status? + gl_project.builds_enabled? && ci_yaml_file + end + private def save_yaml_error(error) diff --git a/app/views/projects/commit/_commit_box.html.haml b/app/views/projects/commit/_commit_box.html.haml index 132cdc35c94..634924db247 100644 --- a/app/views/projects/commit/_commit_box.html.haml +++ b/app/views/projects/commit/_commit_box.html.haml @@ -40,7 +40,7 @@ - @commit.parents.each do |parent| = link_to parent.short_id, namespace_project_commit_path(@project.namespace, @project, parent), class: "monospace" -- if @ci_commit +- if @ci_commit && @ci_commit.show_build_status? .pull-right = link_to ci_status_path(@ci_commit), class: "ci-status ci-#{@ci_commit.status}" do = ci_status_icon(@ci_commit) diff --git a/app/views/projects/commits/_commit.html.haml b/app/views/projects/commits/_commit.html.haml index 0d64486164e..1303b27c4f3 100644 --- a/app/views/projects/commits/_commit.html.haml +++ b/app/views/projects/commits/_commit.html.haml @@ -9,7 +9,7 @@ - cache_key.push(ci_commit.status) if ci_commit = cache(cache_key) do - %li.commit.js-toggle-container + %li.commit.js-toggle-container{ id: "commit-#{commit.short_id}" } .commit-row-title %strong.str-truncated = link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message" @@ -17,7 +17,7 @@ %a.text-expander.js-toggle-button ... .pull-right - - if ci_commit + - if ci_commit && ci_commit.show_build_status? = render_ci_status(ci_commit) = clipboard_button(clipboard_text: commit.id) |
