Commit b86443c4 authored by Phil Hughes's avatar Phil Hughes

Merge branch '28822-no-commit-message' into 'master'

Change --no-commit-message to No commit message

Closes #28822

See merge request gitlab-org/gitlab!22765
parents 9e85c758 31dee2e5
......@@ -104,7 +104,11 @@ export default {
</span>
<div class="commit-detail flex-list">
<div class="commit-content qa-commit-content">
<gl-link :href="commit.webUrl" class="commit-row-message item-title">
<gl-link
:href="commit.webUrl"
:class="{ 'font-italic': !commit.message }"
class="commit-row-message item-title"
>
{{ commit.title }}
</gl-link>
<gl-button
......
......@@ -6,6 +6,7 @@ query pathLastCommit($projectPath: ID!, $path: String, $ref: String!) {
sha
title
description
message
webUrl
authoredDate
authorName
......
......@@ -21,9 +21,9 @@
.commit-detail.flex-list
.commit-content.qa-commit-content
- if view_details && merge_request
= link_to commit.title, project_commit_path(project, commit.id, merge_request_iid: merge_request.iid), class: "commit-row-message item-title js-onboarding-commit-item"
= link_to commit.title, project_commit_path(project, commit.id, merge_request_iid: merge_request.iid), class: ["commit-row-message item-title js-onboarding-commit-item", ("font-italic" if commit.message.empty?)]
- else
= link_to_markdown_field(commit, :title, link, class: "commit-row-message item-title js-onboarding-commit-item")
= link_to_markdown_field(commit, :title, link, class: "commit-row-message item-title js-onboarding-commit-item #{"font-italic" if commit.message.empty?}")
%span.commit-row-message.d-inline.d-sm-none
&middot;
= commit.short_id
......
---
title: Updated no commit verbiage
merge_request: 22765
author:
type: other
......@@ -254,7 +254,7 @@ module Gitlab
end
def no_commit_message
"--no commit message"
"No commit message"
end
def to_hash
......
......@@ -6,7 +6,7 @@ import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link
let vm;
function createCommitData(data = {}) {
return {
const defaultData = {
sha: '123456789',
title: 'Commit title',
message: 'Commit message',
......@@ -26,8 +26,8 @@ function createCommitData(data = {}) {
group: {},
},
},
...data,
};
return Object.assign(defaultData, data);
}
function factory(commit = createCommitData(), loading = false) {
......@@ -46,6 +46,8 @@ function factory(commit = createCommitData(), loading = false) {
vm.vm.$apollo.queries.commit.loading = loading;
}
const emptyMessageClass = 'font-italic';
describe('Repository last commit component', () => {
afterEach(() => {
vm.destroy();
......@@ -135,4 +137,12 @@ describe('Repository last commit component', () => {
expect(vm.element).toMatchSnapshot();
});
});
it('sets correct CSS class if the commit message is empty', () => {
factory(createCommitData({ message: '' }));
return vm.vm.$nextTick().then(() => {
expect(vm.find('.item-title').classes()).toContain(emptyMessageClass);
});
});
});
......@@ -57,7 +57,7 @@ describe Gitlab::Git::Commit, :seed_helper do
it { expect(@commit.different_committer?).to be_truthy }
it { expect(@commit.parents).to eq(@gitlab_parents) }
it { expect(@commit.parent_id).to eq(@parents.first.oid) }
it { expect(@commit.no_commit_message).to eq("--no commit message") }
it { expect(@commit.no_commit_message).to eq("No commit message") }
after do
# Erase the new commit so other tests get the original repo
......
......@@ -277,7 +277,7 @@ describe Commit do
describe '#title' do
it "returns no_commit_message when safe_message is blank" do
allow(commit).to receive(:safe_message).and_return('')
expect(commit.title).to eq("--no commit message")
expect(commit.title).to eq("No commit message")
end
it 'truncates a message without a newline at natural break to 80 characters' do
......@@ -308,7 +308,7 @@ eos
describe '#full_title' do
it "returns no_commit_message when safe_message is blank" do
allow(commit).to receive(:safe_message).and_return('')
expect(commit.full_title).to eq("--no commit message")
expect(commit.full_title).to eq("No commit message")
end
it "returns entire message if there is no newline" do
......@@ -330,7 +330,7 @@ eos
it 'returns no_commit_message when safe_message is blank' do
allow(commit).to receive(:safe_message).and_return(nil)
expect(commit.description).to eq('--no commit message')
expect(commit.description).to eq('No commit message')
end
it 'returns description of commit message if title less than 100 characters' do
......
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