From 6aed2212bd82ca09780b2a1dc686fae20dc78dac Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Thu, 6 Dec 2018 15:10:14 +0100 Subject: Display "commented" only for commit discussions on merge requests Add commit prop to NoteableNote component and pass it from NoteableDiscussion --- .../notes/components/noteable_discussion.vue | 11 +++++++ .../javascripts/notes/components/noteable_note.vue | 35 +++++++++++++++++----- 2 files changed, 39 insertions(+), 7 deletions(-) (limited to 'app/assets/javascripts') diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue index d9dd08a7a6b..bba215852b7 100644 --- a/app/assets/javascripts/notes/components/noteable_discussion.vue +++ b/app/assets/javascripts/notes/components/noteable_discussion.vue @@ -211,6 +211,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.`; :note="componentData(initialDiscussion)" :line="line" :help-page-path="helpPagePath" + :commit="commit" @handleDeleteNote="deleteNoteHandler" > 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 = ``; + const linkEnd = ''; + return sprintf( + s__('MergeRequests|commented on commit %{linkStart}%{commitId}%{linkEnd}'), + { + commitId: truncateSha(id), + linkStart, + linkEnd, + }, + false, + ); + } + + return '·'; + }, }, created() { @@ -200,13 +225,9 @@ export default {
- + + +