Commit 3d9c7a0e authored by Douwe Maan's avatar Douwe Maan

Merge branch '19420-render-only-commit-title' into 'master'

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
parents c367fa8e 4ff3ef6f
...@@ -117,6 +117,7 @@ v 8.10.0 (unreleased) ...@@ -117,6 +117,7 @@ v 8.10.0 (unreleased)
- Create Todos for Issue author when assign or mention himself (Katarzyna Kobierska) - Create Todos for Issue author when assign or mention himself (Katarzyna Kobierska)
- Limit the number of retries on error to 3 for exporting projects - Limit the number of retries on error to 3 for exporting projects
- Allow empty repositories on project import/export - Allow empty repositories on project import/export
- Render only commit message title in builds (Katarzyna Kobierska Ula Budziszewska)
v 8.9.6 v 8.9.6
- Fix importing of events under notes for GitLab projects. !5154 - Fix importing of events under notes for GitLab projects. !5154
......
...@@ -51,6 +51,10 @@ module Ci ...@@ -51,6 +51,10 @@ module Ci
commit.try(:message) commit.try(:message)
end end
def git_commit_title
commit.try(:title)
end
def short_sha def short_sha
Ci::Pipeline.truncate_sha(sha) Ci::Pipeline.truncate_sha(sha)
end end
......
...@@ -94,9 +94,9 @@ ...@@ -94,9 +94,9 @@
.block .block
.title .title
Commit message Commit title
%p.build-light-text.append-bottom-0 %p.build-light-text.append-bottom-0
#{@build.pipeline.git_commit_message} #{@build.pipeline.git_commit_title}
- if @build.tags.any? - if @build.tags.any?
.block .block
......
...@@ -3,8 +3,12 @@ require 'spec_helper' ...@@ -3,8 +3,12 @@ require 'spec_helper'
describe 'projects/builds/show' do describe 'projects/builds/show' do
include Devise::TestHelpers include Devise::TestHelpers
let(:build) { create(:ci_build) } let(:project) { create(:project) }
let(:project) { build.project } let(:pipeline) do
create(:ci_pipeline, project: project,
sha: project.commit.id)
end
let(:build) { create(:ci_build, pipeline: pipeline) }
before do before do
assign(:build, build) assign(:build, build)
...@@ -34,4 +38,15 @@ describe 'projects/builds/show' do ...@@ -34,4 +38,15 @@ describe 'projects/builds/show' do
expect(rendered).to have_link('Retry') expect(rendered).to have_link('Retry')
end end
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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment