Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-12-21 00:10:50 +0300
committerMike Greiling <mike@pixelcog.com>2018-12-21 00:10:50 +0300
commit62d250ff666770f9807eec2199a7b208ea8b518a (patch)
tree15034db1e7b8b9d8896ff58409280c82aaac62c8 /app
parenta39008fed3d16b081c8a694f6ea4d2a556075a71 (diff)
parent795b4a307f5e03714e022978a0a0f14a47a23eb4 (diff)
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')
-rw-r--r--app/assets/javascripts/notes/components/noteable_discussion.vue11
-rw-r--r--app/assets/javascripts/notes/components/noteable_note.vue35
-rw-r--r--app/helpers/notes_helper.rb2
3 files changed, 40 insertions, 8 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"
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index 033686823a2..293dd20ad49 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -85,7 +85,7 @@ module NotesHelper
diffs_project_merge_request_path(discussion.project, discussion.noteable, path_params)
elsif discussion.for_commit?
- anchor = discussion.line_code if discussion.diff_discussion?
+ anchor = discussion.diff_discussion? ? discussion.line_code : "note_#{discussion.first_note.id}"
project_commit_path(discussion.project, discussion.noteable, anchor: anchor)
end