diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-07-18 20:24:25 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-07-18 20:24:25 +0000 |
commit | 3d9c7a0e215355823c182f9302547a0e8e0a1b56 (patch) | |
tree | 2dc7c2270ce6ffde01ec4dea8a0b9ea140e048b6 | |
parent | c367fa8eb773a049ffdfe4735d42254ed808fef2 (diff) | |
parent | 4ff3ef6f925633f66a120c4844d93542bb1d6e2a (diff) | |
download | gitlab-ce-3d9c7a0e215355823c182f9302547a0e8e0a1b56.tar.gz |
Merge branch '19420-render-only-commit-title' into 'master'
19889-shortcuts-modal-is-broken
Render only commit title
## What does this MR do?
Render only commit title in builds
## Why was this MR needed?
Better readability
## What are the relevant issue numbers?
Closes #19420
## Screenshots (if relevant)
![after](/uploads/fcdd59d74a0f91f6ac847f7f02d5f07f/after.png)![before](/uploads/71ca6dabf31452a1a8dfb15ecb8860c5/before.png)
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
- [x] All builds are passing
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
cc: @kradydal @yorickpeterse @grzesiek @tmaczukin @dzaporozhets [@tomash](https://github.com/tomash) [@chastell](https://github.com/chastell)
this is connected to closed MR [!5109](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5109)
See merge request !5131
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 4 | ||||
-rw-r--r-- | app/views/projects/builds/_sidebar.html.haml | 4 | ||||
-rw-r--r-- | spec/views/projects/builds/show.html.haml_spec.rb | 19 |
4 files changed, 24 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG index 39651675e79..7bc020c8d68 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -117,6 +117,7 @@ v 8.10.0 (unreleased) - Create Todos for Issue author when assign or mention himself (Katarzyna Kobierska) - Limit the number of retries on error to 3 for exporting projects - Allow empty repositories on project import/export + - Render only commit message title in builds (Katarzyna Kobierska Ula Budziszewska) v 8.9.6 - Fix importing of events under notes for GitLab projects. !5154 diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index b468434866b..a65a826536d 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -51,6 +51,10 @@ module Ci commit.try(:message) end + def git_commit_title + commit.try(:title) + end + def short_sha Ci::Pipeline.truncate_sha(sha) end diff --git a/app/views/projects/builds/_sidebar.html.haml b/app/views/projects/builds/_sidebar.html.haml index cab21f0cf19..396cc4ad925 100644 --- a/app/views/projects/builds/_sidebar.html.haml +++ b/app/views/projects/builds/_sidebar.html.haml @@ -94,9 +94,9 @@ .block .title - Commit message + Commit title %p.build-light-text.append-bottom-0 - #{@build.pipeline.git_commit_message} + #{@build.pipeline.git_commit_title} - if @build.tags.any? .block diff --git a/spec/views/projects/builds/show.html.haml_spec.rb b/spec/views/projects/builds/show.html.haml_spec.rb index cd18d19ef5e..42220a20c75 100644 --- a/spec/views/projects/builds/show.html.haml_spec.rb +++ b/spec/views/projects/builds/show.html.haml_spec.rb @@ -3,8 +3,12 @@ require 'spec_helper' describe 'projects/builds/show' do include Devise::TestHelpers - let(:build) { create(:ci_build) } - let(:project) { build.project } + let(:project) { create(:project) } + let(:pipeline) do + create(:ci_pipeline, project: project, + sha: project.commit.id) + end + let(:build) { create(:ci_build, pipeline: pipeline) } before do assign(:build, build) @@ -34,4 +38,15 @@ describe 'projects/builds/show' do expect(rendered).to have_link('Retry') end end + + describe 'commit title in sidebar' do + let(:commit_title) { project.commit.title } + + it 'shows commit title and not show commit message' do + render + + expect(rendered).to have_css('p.build-light-text.append-bottom-0', + text: /\A\n#{Regexp.escape(commit_title)}\n\Z/) + end + end end |