diff options
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/notes/components/noteable_discussion.vue | 11 | ||||
-rw-r--r-- | app/assets/javascripts/notes/components/noteable_note.vue | 30 |
2 files changed, 39 insertions, 2 deletions
diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue index 4480ec74182..aeb7171068a 100644 --- a/app/assets/javascripts/notes/components/noteable_discussion.vue +++ b/app/assets/javascripts/notes/components/noteable_discussion.vue @@ -212,6 +212,16 @@ export default { return this.line; }, + commit() { + if (!this.discussion.for_commit) { + return null; + } + + return { + id: this.discussion.commit_id, + url: this.discussion.discussion_path, + }; + }, }, watch: { isReplying() { @@ -376,6 +386,7 @@ Please check your network connection and try again.`; :is="componentName(initialDiscussion)" :note="componentData(initialDiscussion)" :line="line" + :commit="commit" :help-page-path="helpPagePath" @handleDeleteNote="deleteNoteHandler" > diff --git a/app/assets/javascripts/notes/components/noteable_note.vue b/app/assets/javascripts/notes/components/noteable_note.vue index 4c02588127e..c39dcc71aa6 100644 --- a/app/assets/javascripts/notes/components/noteable_note.vue +++ b/app/assets/javascripts/notes/components/noteable_note.vue @@ -2,6 +2,8 @@ import $ from 'jquery'; import { mapGetters, mapActions } from 'vuex'; import { escape } from 'underscore'; +import { truncateSha } from '~/lib/utils/text_utility'; +import { s__, sprintf } from '~/locale'; import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue'; import Flash from '../../flash'; import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; @@ -37,6 +39,11 @@ export default { required: false, default: '', }, + commit: { + type: Object, + required: false, + default: () => null, + }, }, data() { return { @@ -73,6 +80,24 @@ export default { isTarget() { return this.targetNoteHash === this.noteAnchorId; }, + actionText() { + if (this.commit) { + const { id, url } = this.commit; + const linkStart = `<a class="commit-sha monospace" href="${escape(url)}">`; + const linkEnd = '</a>'; + return sprintf( + s__('MergeRequests|commented on commit %{linkStart}%{commitId}%{linkEnd}'), + { + commitId: truncateSha(id), + linkStart, + linkEnd, + }, + false, + ); + } + + return '<span class="d-none d-sm-inline">·</span>'; + }, }, created() { @@ -205,8 +230,9 @@ export default { :author="author" :created-at="note.created_at" :note-id="note.id" - action-text="commented" - /> + > + <span v-html="actionText"></span> + </note-header> <note-actions :author-id="author.id" :note-id="note.id" |