Commit f32b0f2c authored by Winnie Hellmann's avatar Winnie Hellmann

Revert "Merge branch 'winh-discussion-header-commented-ee' into 'master'"

This reverts merge request !8790

(cherry picked from commit 0d3bd9e8e660cb87cad0a0cb5dcb5097062c5514)
parent e4637d68
......@@ -222,16 +222,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() {
......@@ -397,7 +387,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
......
......@@ -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">&middot;</span>';
},
},
created() {
......@@ -229,9 +204,14 @@ 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">
<slot slot="note-header-info" name="note-header-info"></slot>
<span v-html="actionText"></span>
<note-header
v-once
:author="author"
:created-at="note.created_at"
:note-id="note.id"
action-text="commented"
>
<slot slot="note-header-info" name="note-header-info"> </slot>
</note-header>
<note-actions
:author-id="author.id"
......
......@@ -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
......
---
title: Display "commented" only for commit discussions on merge requests
merge_request: 23622
author:
type: fixed
......@@ -137,7 +137,7 @@ describe 'Referencing Epics', :js do
find('div#notes li.note div.note-text a').click
page.within('div#notes li.note.system-note .system-note-message') do
page.within('div#notes li.note .system-note-message') do
expect(page).to have_content('mentioned in epic')
expect(page.find('a')).to have_content(epic.to_reference(full: true))
end
......
......@@ -5438,9 +5438,6 @@ msgstr ""
msgid "MergeRequests|View replaced file @ %{commitId}"
msgstr ""
msgid "MergeRequests|commented on commit %{linkStart}%{commitId}%{linkEnd}"
msgstr ""
msgid "MergeRequests|started a discussion"
msgstr ""
......
......@@ -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
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment