Skip to content
代码片段 群组 项目
提交 6adf2ad8 编辑于 作者: Andrew Fontaine's avatar Andrew Fontaine
浏览文件

Display commit title instead of message

The message is the entire multi-line commit message, which doesn't
truncate well. Instead, show the title, which should be a good headline
for the commmit.

Changelog: changed
上级 620482f1
No related branches found
No related tags found
无相关合并请求
......@@ -25,7 +25,7 @@ query fetchDeployment($fullPath: ID!, $iid: ID!) {
commit {
id
shortId
message
title
webUrl
authorGravatar
authorName
......
......@@ -19,8 +19,8 @@ export default {
},
},
computed: {
commitMessage() {
return this.commit?.message;
commitTitle() {
return this.commit?.title;
},
commitAuthorPath() {
return this.commit?.author?.path || `mailto:${escape(this.commit?.authorEmail)}`;
......@@ -42,13 +42,8 @@ export default {
<gl-avatar-link v-gl-tooltip :title="commitAuthor" :href="commitAuthorPath">
<gl-avatar :size="16" :src="commitAuthorAvatar" />
</gl-avatar-link>
<gl-link
v-gl-tooltip
:title="commitMessage"
:href="commitPath"
class="gl-ml-3 gl-str-truncated"
>
{{ commitMessage }}
<gl-link v-gl-tooltip :title="commitTitle" :href="commitPath" class="gl-ml-3 gl-str-truncated">
{{ commitTitle }}
</gl-link>
</div>
</template>
......@@ -37,8 +37,8 @@ describe('~/environments/components/commit.vue', () => {
expect(avatar.attributes('src')).toBe(commit.author.avatarUrl);
});
it('links the commit message to the commit', () => {
const message = wrapper.findByRole('link', { name: commit.message });
it('links the commit title to the commit', () => {
const message = wrapper.findByRole('link', { name: commit.title });
expect(message.attributes('href')).toBe(commit.commitPath);
});
......@@ -62,10 +62,10 @@ describe('~/environments/components/commit.vue', () => {
expect(avatar.attributes('src')).toBe(commit.authorGravatarUrl);
});
it('displays the commit message', () => {
const message = wrapper.findByRole('link', { name: commit.message });
it('displays the commit title', () => {
const title = wrapper.findByRole('link', { name: commit.title });
expect(message.attributes('href')).toBe(commit.commitPath);
expect(title.attributes('href')).toBe(commit.commitPath);
});
});
});
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册