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 { ...@@ -81,6 +81,10 @@ export default {
showCommitId() { showCommitId() {
return this.commit?.sha?.substr(0, 8); return this.commit?.sha?.substr(0, 8);
}, },
commitDescription() {
// Strip the newline at the beginning
return this.commit?.descriptionHtml?.replace(/^
/, '');
},
}, },
watch: { watch: {
currentPath() { currentPath() {
...@@ -146,10 +150,10 @@ export default { ...@@ -146,10 +150,10 @@ export default {
<timeago-tooltip :time="commit.authoredDate" tooltip-placement="bottom" /> <timeago-tooltip :time="commit.authoredDate" tooltip-placement="bottom" />
</div> </div>
<pre <pre
v-if="commit.descriptionHtml" v-if="commitDescription"
:class="{ 'd-block': showDescription }" :class="{ 'd-block': showDescription }"
class="commit-row-description gl-mb-3" class="commit-row-description gl-mb-3"
v-html="commit.descriptionHtml" v-html="commitDescription"
></pre> ></pre>
</div> </div>
<div class="commit-actions flex-row"> <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', () => { ...@@ -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', () => { it('renders the signature HTML as returned by the backend', () => {
factory(createCommitData({ signatureHtml: '<button>Verified</button>' })); 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