Commit bd7b36f6 authored by Kev's avatar Kev Committed by Kushal Pandya

Strip newline from commit description on project overview

parent ddad0826
......@@ -81,6 +81,10 @@ export default {
showCommitId() {
return this.commit?.sha?.substr(0, 8);
},
commitDescription() {
// Strip the newline at the beginning
return this.commit?.descriptionHtml?.replace(/^
/, '');
},
},
watch: {
currentPath() {
......@@ -146,10 +150,10 @@ export default {
<timeago-tooltip :time="commit.authoredDate" tooltip-placement="bottom" />
</div>
<pre
v-if="commit.descriptionHtml"
v-if="commitDescription"
:class="{ 'd-block': showDescription }"
class="commit-row-description gl-mb-3"
v-html="commit.descriptionHtml"
v-html="commitDescription"
></pre>
</div>
<div class="commit-actions flex-row">
......
---
title: Strip newline from commit description on project overview
merge_request: 51099
author: Kev @KevSlashNull
type: fixed
......@@ -131,6 +131,16 @@ describe('Repository last commit component', () => {
});
});
it('strips the first newline of the description', async () => {
factory(createCommitData({ descriptionHtml: '&#x000A;Update ADOPTERS.md' }));
await vm.vm.$nextTick();
expect(vm.find('.commit-row-description').html()).toBe(
'<pre class="commit-row-description gl-mb-3">Update ADOPTERS.md</pre>',
);
});
it('renders the signature HTML as returned by the backend', () => {
factory(createCommitData({ signatureHtml: '<button>Verified</button>' }));
......
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