summaryrefslogtreecommitdiff
path: root/app/assets/javascripts
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-12-20 21:10:50 +0000
committerMike Greiling <mike@pixelcog.com>2018-12-20 21:10:50 +0000
commit62d250ff666770f9807eec2199a7b208ea8b518a (patch)
tree15034db1e7b8b9d8896ff58409280c82aaac62c8 /app/assets/javascripts
parenta39008fed3d16b081c8a694f6ea4d2a556075a71 (diff)
parent795b4a307f5e03714e022978a0a0f14a47a23eb4 (diff)
downloadgitlab-ce-62d250ff666770f9807eec2199a7b208ea8b518a.tar.gz
Merge branch 'winh-discussion-header-commented' into 'master'
Display "commented" only for commit discussions on merge requests Closes #53950 and #53681 See merge request gitlab-org/gitlab-ce!23622
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/notes/components/noteable_discussion.vue11
-rw-r--r--app/assets/javascripts/notes/components/noteable_note.vue35
2 files changed, 39 insertions, 7 deletions
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"
>
<note-edited-text
diff --git a/app/assets/javascripts/notes/components/noteable_note.vue b/app/assets/javascripts/notes/components/noteable_note.vue
index 4c02588127e..6edc65c856e 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">&middot;</span>';
+ },
},
created() {
@@ -200,13 +225,9 @@ export default {
</div>
<div class="timeline-content">
<div class="note-header">
- <note-header
- v-once
- :author="author"
- :created-at="note.created_at"
- :note-id="note.id"
- action-text="commented"
- />
+ <note-header v-once :author="author" :created-at="note.created_at" :note-id="note.id">
+ <span v-html="actionText"></span>
+ </note-header>
<note-actions
:author-id="author.id"
:note-id="note.id"