| ... | @@ -5,44 +5,35 @@ import { GlTooltipDirective } from '@gitlab/ui'; |
... | @@ -5,44 +5,35 @@ import { GlTooltipDirective } from '@gitlab/ui'; |
|
|
import { truncateSha } from '~/lib/utils/text_utility';
|
|
import { truncateSha } from '~/lib/utils/text_utility';
|
|
|
import { s__, __, sprintf } from '~/locale';
|
|
import { s__, __, sprintf } from '~/locale';
|
|
|
import { clearDraft, getDiscussionReplyKey } from '~/lib/utils/autosave';
|
|
import { clearDraft, getDiscussionReplyKey } from '~/lib/utils/autosave';
|
|
|
import systemNote from '~/vue_shared/components/notes/system_note.vue';
|
|
|
|
|
import icon from '~/vue_shared/components/icon.vue';
|
|
import icon from '~/vue_shared/components/icon.vue';
|
|
|
import diffLineNoteFormMixin from 'ee_else_ce/notes/mixins/diff_line_note_form';
|
|
import diffLineNoteFormMixin from 'ee_else_ce/notes/mixins/diff_line_note_form';
|
|
|
import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue';
|
|
import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue';
|
|
|
import Flash from '../../flash';
|
|
import Flash from '../../flash';
|
|
|
import { SYSTEM_NOTE } from '../constants';
|
|
|
|
|
import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
|
|
import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
|
|
|
import noteableNote from './noteable_note.vue';
|
|
|
|
|
import noteHeader from './note_header.vue';
|
|
import noteHeader from './note_header.vue';
|
|
|
import toggleRepliesWidget from './toggle_replies_widget.vue';
|
|
|
|
|
import noteSignedOutWidget from './note_signed_out_widget.vue';
|
|
import noteSignedOutWidget from './note_signed_out_widget.vue';
|
|
|
import noteEditedText from './note_edited_text.vue';
|
|
import noteEditedText from './note_edited_text.vue';
|
|
|
import noteForm from './note_form.vue';
|
|
import noteForm from './note_form.vue';
|
|
|
import diffWithNote from './diff_with_note.vue';
|
|
import diffWithNote from './diff_with_note.vue';
|
|
|
import placeholderNote from '../../vue_shared/components/notes/placeholder_note.vue';
|
|
|
|
|
import placeholderSystemNote from '../../vue_shared/components/notes/placeholder_system_note.vue';
|
|
|
|
|
import noteable from '../mixins/noteable';
|
|
import noteable from '../mixins/noteable';
|
|
|
import resolvable from '../mixins/resolvable';
|
|
import resolvable from '../mixins/resolvable';
|
|
|
import discussionNavigation from '../mixins/discussion_navigation';
|
|
import discussionNavigation from '../mixins/discussion_navigation';
|
|
|
import eventHub from '../event_hub';
|
|
import eventHub from '../event_hub';
|
|
|
|
import DiscussionNotes from './discussion_notes.vue';
|
|
|
import DiscussionActions from './discussion_actions.vue';
|
|
import DiscussionActions from './discussion_actions.vue';
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'NoteableDiscussion',
|
|
name: 'NoteableDiscussion',
|
|
|
components: {
|
|
components: {
|
|
|
icon,
|
|
icon,
|
|
|
noteableNote,
|
|
|
|
|
userAvatarLink,
|
|
userAvatarLink,
|
|
|
noteHeader,
|
|
noteHeader,
|
|
|
noteSignedOutWidget,
|
|
noteSignedOutWidget,
|
|
|
noteEditedText,
|
|
noteEditedText,
|
|
|
noteForm,
|
|
noteForm,
|
|
|
toggleRepliesWidget,
|
|
|
|
|
placeholderNote,
|
|
|
|
|
placeholderSystemNote,
|
|
|
|
|
systemNote,
|
|
|
|
|
DraftNote: () => import('ee_component/batch_comments/components/draft_note.vue'),
|
|
DraftNote: () => import('ee_component/batch_comments/components/draft_note.vue'),
|
|
|
TimelineEntryItem,
|
|
TimelineEntryItem,
|
|
|
|
DiscussionNotes,
|
|
|
DiscussionActions,
|
|
DiscussionActions,
|
|
|
},
|
|
},
|
|
|
directives: {
|
|
directives: {
|
| ... | @@ -91,6 +82,7 @@ export default { |
... | @@ -91,6 +82,7 @@ export default { |
|
|
...mapGetters([
|
|
...mapGetters([
|
|
|
'convertedDisscussionIds',
|
|
'convertedDisscussionIds',
|
|
|
'getNoteableData',
|
|
'getNoteableData',
|
|
|
|
'userCanReply',
|
|
|
'nextUnresolvedDiscussionId',
|
|
'nextUnresolvedDiscussionId',
|
|
|
'unresolvedDiscussionsCount',
|
|
'unresolvedDiscussionsCount',
|
|
|
'hasUnresolvedDiscussions',
|
|
'hasUnresolvedDiscussions',
|
| ... | @@ -102,21 +94,12 @@ export default { |
... | @@ -102,21 +94,12 @@ export default { |
|
|
autosaveKey() {
|
|
autosaveKey() {
|
|
|
return getDiscussionReplyKey(this.firstNote.noteable_type, this.discussion.id);
|
|
return getDiscussionReplyKey(this.firstNote.noteable_type, this.discussion.id);
|
|
|
},
|
|
},
|
|
|
canReply() {
|
|
|
|
|
return this.getNoteableData.current_user.can_create_note;
|
|
|
|
|
},
|
|
|
|
|
newNotePath() {
|
|
newNotePath() {
|
|
|
return this.getNoteableData.create_note_path;
|
|
return this.getNoteableData.create_note_path;
|
|
|
},
|
|
},
|
|
|
hasReplies() {
|
|
|
|
|
return this.discussion.notes.length > 1;
|
|
|
|
|
},
|
|
|
|
|
firstNote() {
|
|
firstNote() {
|
|
|
return this.discussion.notes.slice(0, 1)[0];
|
|
return this.discussion.notes.slice(0, 1)[0];
|
|
|
},
|
|
},
|
|
|
replies() {
|
|
|
|
|
return this.discussion.notes.slice(1);
|
|
|
|
|
},
|
|
|
|
|
lastUpdatedBy() {
|
|
lastUpdatedBy() {
|
|
|
const { notes } = this.discussion;
|
|
const { notes } = this.discussion;
|
|
|
|
|
|
| ... | @@ -222,18 +205,8 @@ export default { |
... | @@ -222,18 +205,8 @@ export default { |
|
|
|
|
|
|
|
return null;
|
|
return null;
|
|
|
},
|
|
},
|
|
|
commit() {
|
|
|
|
|
if (!this.discussion.for_commit) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
id: this.discussion.commit_id,
|
|
|
|
|
url: this.discussion.discussion_path,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
resolveWithIssuePath() {
|
|
resolveWithIssuePath() {
|
|
|
return !this.discussionResolved && this.discussion.resolve_with_issue_path;
|
|
return !this.discussionResolved ? this.discussion.resolve_with_issue_path : '';
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
| ... | @@ -252,24 +225,6 @@ export default { |
... | @@ -252,24 +225,6 @@ export default { |
|
|
'removeConvertedDiscussion',
|
|
'removeConvertedDiscussion',
|
|
|
]),
|
|
]),
|
|
|
truncateSha,
|
|
truncateSha,
|
|
|
componentName(note) {
|
|
|
|
|
if (note.isPlaceholderNote) {
|
|
|
|
|
if (note.placeholderType === SYSTEM_NOTE) {
|
|
|
|
|
return placeholderSystemNote;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return placeholderNote;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (note.system) {
|
|
|
|
|
return systemNote;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return noteableNote;
|
|
|
|
|
},
|
|
|
|
|
componentData(note) {
|
|
|
|
|
return note.isPlaceholderNote ? note.notes[0] : note;
|
|
|
|
|
},
|
|
|
|
|
toggleDiscussionHandler() {
|
|
toggleDiscussionHandler() {
|
|
|
this.toggleDiscussion({ discussionId: this.discussion.id });
|
|
this.toggleDiscussion({ discussionId: this.discussion.id });
|
|
|
},
|
|
},
|
| ... | @@ -399,73 +354,31 @@ Please check your network connection and try again.`; |
... | @@ -399,73 +354,31 @@ Please check your network connection and try again.`; |
|
|
v-bind="wrapperComponentProps"
|
|
v-bind="wrapperComponentProps"
|
|
|
class="card discussion-wrapper"
|
|
class="card discussion-wrapper"
|
|
|
>
|
|
>
|
|
|
<div class="discussion-notes">
|
|
<discussion-notes
|
|
|
<ul class="notes">
|
|
:discussion="discussion"
|
|
|
<template v-if="shouldGroupReplies">
|
|
:diff-line="diffLine"
|
|
|
<component
|
|
|
|
|
:is="componentName(firstNote)"
|
|
|
|
|
:note="componentData(firstNote)"
|
|
|
|
|
:line="line"
|
|
|
|
|
:commit="commit"
|
|
|
|
|
:help-page-path="helpPagePath"
|
|
:help-page-path="helpPagePath"
|
|
|
:show-reply-button="canReply"
|
|
:is-expanded="isExpanded"
|
|
|
@handleDeleteNote="deleteNoteHandler"
|
|
:line="line"
|
|
|
|
:should-group-replies="shouldGroupReplies"
|
|
|
@startReplying="showReplyForm"
|
|
@startReplying="showReplyForm"
|
|
|
|
@toggleDiscussion="toggleDiscussionHandler"
|
|
|
|
@deleteNote="deleteNoteHandler"
|
|
|
>
|
|
>
|
|
|
<note-edited-text
|
|
|
|
|
v-if="discussion.resolved"
|
|
|
|
|
slot="discussion-resolved-text"
|
|
|
|
|
:edited-at="discussion.resolved_at"
|
|
|
|
|
:edited-by="discussion.resolved_by"
|
|
|
|
|
:action-text="resolvedText"
|
|
|
|
|
class-name="discussion-headline-light js-discussion-headline discussion-resolved-text"
|
|
|
|
|
/>
|
|
|
|
|
<slot slot="avatar-badge" name="avatar-badge"></slot>
|
|
<slot slot="avatar-badge" name="avatar-badge"></slot>
|
|
|
</component>
|
|
<template #footer="{ showReplies }">
|
|
|
<toggle-replies-widget
|
|
|
|
|
v-if="hasReplies"
|
|
|
|
|
:collapsed="!isExpanded"
|
|
|
|
|
:replies="replies"
|
|
|
|
|
@toggle="toggleDiscussionHandler"
|
|
|
|
|
/>
|
|
|
|
|
<template v-if="isExpanded">
|
|
|
|
|
<component
|
|
|
|
|
:is="componentName(note)"
|
|
|
|
|
v-for="note in replies"
|
|
|
|
|
:key="note.id"
|
|
|
|
|
:note="componentData(note)"
|
|
|
|
|
:help-page-path="helpPagePath"
|
|
|
|
|
:line="line"
|
|
|
|
|
@handleDeleteNote="deleteNoteHandler"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
|
|
|
|
<component
|
|
|
|
|
:is="componentName(note)"
|
|
|
|
|
v-for="(note, index) in discussion.notes"
|
|
|
|
|
:key="note.id"
|
|
|
|
|
:note="componentData(note)"
|
|
|
|
|
:help-page-path="helpPagePath"
|
|
|
|
|
:line="diffLine"
|
|
|
|
|
@handleDeleteNote="deleteNoteHandler"
|
|
|
|
|
>
|
|
|
|
|
<slot v-if="index === 0" slot="avatar-badge" name="avatar-badge"></slot>
|
|
|
|
|
</component>
|
|
|
|
|
</template>
|
|
|
|
|
</ul>
|
|
|
|
|
<draft-note
|
|
<draft-note
|
|
|
v-if="showDraft(discussion.reply_id)"
|
|
v-if="showDraft(discussion.reply_id)"
|
|
|
:key="`draft_${discussion.id}`"
|
|
:key="`draft_${discussion.id}`"
|
|
|
:draft="draftForDiscussion(discussion.reply_id)"
|
|
:draft="draftForDiscussion(discussion.reply_id)"
|
|
|
/>
|
|
/>
|
|
|
<div
|
|
<div
|
|
|
v-else-if="isExpanded || !hasReplies"
|
|
v-else-if="showReplies"
|
|
|
:class="{ 'is-replying': isReplying }"
|
|
:class="{ 'is-replying': isReplying }"
|
|
|
class="discussion-reply-holder"
|
|
class="discussion-reply-holder"
|
|
|
>
|
|
>
|
|
|
<discussion-actions
|
|
<discussion-actions
|
|
|
v-if="!isReplying && canReply"
|
|
v-if="!isReplying && userCanReply"
|
|
|
:discussion="discussion"
|
|
:discussion="discussion"
|
|
|
:is-resolving="isResolving"
|
|
:is-resolving="isResolving"
|
|
|
:resolve-button-title="resolveButtonTitle"
|
|
:resolve-button-title="resolveButtonTitle"
|
| ... | @@ -487,9 +400,10 @@ Please check your network connection and try again.`; |
... | @@ -487,9 +400,10 @@ Please check your network connection and try again.`; |
|
|
@handleFormUpdate="saveReply"
|
|
@handleFormUpdate="saveReply"
|
|
|
@cancelForm="cancelReplyForm"
|
|
@cancelForm="cancelReplyForm"
|
|
|
/>
|
|
/>
|
|
|
<note-signed-out-widget v-if="!canReply" />
|
|
<note-signed-out-widget v-if="!userCanReply" />
|
|
|
</div>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</discussion-notes>
|
|
|
</component>
|
|
</component>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
| ... | |
... | |
| ... | | ... | |