diff options
-rw-r--r-- | app/assets/javascripts/notes/components/noteable_discussion.vue | 11 | ||||
-rw-r--r-- | app/assets/javascripts/notes/components/noteable_note.vue | 35 | ||||
-rw-r--r-- | app/helpers/notes_helper.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/winh-discussion-header-commented.yml | 5 | ||||
-rw-r--r-- | locale/gitlab.pot | 3 | ||||
-rw-r--r-- | spec/features/merge_request/user_sees_discussions_spec.rb | 8 | ||||
-rw-r--r-- | spec/helpers/notes_helper_spec.rb | 4 |
7 files changed, 10 insertions, 58 deletions
diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue index be451401e97..7c3f5d00308 100644 --- a/app/assets/javascripts/notes/components/noteable_discussion.vue +++ b/app/assets/javascripts/notes/components/noteable_discussion.vue @@ -212,16 +212,6 @@ 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() { @@ -387,7 +377,6 @@ 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 6edc65c856e..4c02588127e 100644 --- a/app/assets/javascripts/notes/components/noteable_note.vue +++ b/app/assets/javascripts/notes/components/noteable_note.vue @@ -2,8 +2,6 @@ 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'; @@ -39,11 +37,6 @@ export default { required: false, default: '', }, - commit: { - type: Object, - required: false, - default: () => null, - }, }, data() { return { @@ -80,24 +73,6 @@ 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() { @@ -225,9 +200,13 @@ 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"> - <span v-html="actionText"></span> - </note-header> + <note-header + v-once + :author="author" + :created-at="note.created_at" + :note-id="note.id" + action-text="commented" + /> <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 293dd20ad49..033686823a2 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.diff_discussion? ? discussion.line_code : "note_#{discussion.first_note.id}" + anchor = discussion.line_code if discussion.diff_discussion? project_commit_path(discussion.project, discussion.noteable, anchor: anchor) end diff --git a/changelogs/unreleased/winh-discussion-header-commented.yml b/changelogs/unreleased/winh-discussion-header-commented.yml deleted file mode 100644 index 8d08409b504..00000000000 --- a/changelogs/unreleased/winh-discussion-header-commented.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Display "commented" only for commit discussions on merge requests -merge_request: 23622 -author: -type: fixed diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 59c377c9ea3..b27efe04966 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -4138,9 +4138,6 @@ msgstr "" msgid "MergeRequests|View replaced file @ %{commitId}" msgstr "" -msgid "MergeRequests|commented on commit %{linkStart}%{commitId}%{linkEnd}" -msgstr "" - msgid "MergeRequests|started a discussion" msgstr "" diff --git a/spec/features/merge_request/user_sees_discussions_spec.rb b/spec/features/merge_request/user_sees_discussions_spec.rb index d130ea05654..4ab9a87ad4b 100644 --- a/spec/features/merge_request/user_sees_discussions_spec.rb +++ b/spec/features/merge_request/user_sees_discussions_spec.rb @@ -88,13 +88,5 @@ describe 'Merge request > User sees discussions', :js do expect(page).to have_content "started a discussion on commit #{note.commit_id[0...7]}" end end - - context 'a commit non-diff discussion' do - let(:note) { create(:discussion_note_on_commit, project: project) } - - it 'displays correct header' do - expect(page).to have_content "commented on commit #{note.commit_id[0...7]}" - end - end end end diff --git a/spec/helpers/notes_helper_spec.rb b/spec/helpers/notes_helper_spec.rb index 0715f34dafe..21461e46cf4 100644 --- a/spec/helpers/notes_helper_spec.rb +++ b/spec/helpers/notes_helper_spec.rb @@ -185,8 +185,8 @@ describe NotesHelper do context 'for a non-diff discussion' do let(:discussion) { create(:discussion_note_on_commit, project: project).to_discussion } - it 'returns the commit path with the note anchor' do - expect(helper.discussion_path(discussion)).to eq(project_commit_path(project, commit, anchor: "note_#{discussion.first_note.id}")) + it 'returns the commit path' do + expect(helper.discussion_path(discussion)).to eq(project_commit_path(project, commit)) end end end |