Skip to content

Move EE differences for `app/assets/javascripts/notes/components/noteable_discussion.vue`

The file app/assets/javascripts/notes/components/noteable_discussion.vue has differences between CE and EE.

Diferences

diff --git a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/assets/javascripts/notes/components/noteable_discussion.vue b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/assets/javascripts/notes/components/noteable_discussion.vue
index 695efe3602f..ce843a7bb4b 100644
--- a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/assets/javascripts/notes/components/noteable_discussion.vue
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/assets/javascripts/notes/components/noteable_discussion.vue
@@ -6,6 +6,8 @@ import { truncateSha } from '~/lib/utils/text_utility';
 import { s__, __, sprintf } from '~/locale';
 import systemNote from '~/vue_shared/components/notes/system_note.vue';
 import icon from '~/vue_shared/components/icon.vue';
+import batchCommentsDiffLineNoteFormMixin from 'ee/batch_comments/mixins/diff_line_note_form';
+import DraftNote from 'ee/batch_comments/components/draft_note.vue';
 import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue';
 import Flash from '../../flash';
 import { SYSTEM_NOTE } from '../constants';
@@ -42,12 +44,19 @@ export default {
     placeholderNote,
     placeholderSystemNote,
     systemNote,
+    DraftNote,
     TimelineEntryItem,
   },
   directives: {
     GlTooltip: GlTooltipDirective,
   },
-  mixins: [autosave, noteable, resolvable, discussionNavigation],
+  mixins: [
+    autosave,
+    noteable,
+    resolvable,
+    discussionNavigation,
+    batchCommentsDiffLineNoteFormMixin,
+  ],
   props: {
     discussion: {
       type: Object,
@@ -85,6 +94,7 @@ export default {
     return {
       isReplying: false,
       isResolving: false,
+      isUnresolving: false,
       resolveAsThread: true,
       isRepliesCollapsed: Boolean(!isDiffDiscussion && resolved),
     };
@@ -440,8 +450,13 @@ Please check your network connection and try again.`;
                   </component>
                 </template>
               </ul>
+              <draft-note
+                v-if="showDraft(discussion.reply_id)"
+                :key="`draft_${discussion.id}`"
+                :draft="draftForDiscussion(discussion.reply_id)"
+              />
               <div
-                v-if="!isRepliesCollapsed || !hasReplies"
+                v-else-if="!isRepliesCollapsed || !hasReplies"
                 :class="{ 'is-replying': isReplying }"
                 class="discussion-reply-holder"
               >
@@ -490,6 +505,7 @@ Please check your network connection and try again.`;
                   :is-editing="false"
                   :line="diffLine"
                   save-button-title="Comment"
+                  @handleFormUpdateAddToReview="addReplyToReview"
                   @handleFormUpdate="saveReply"
                   @cancelForm="cancelReplyForm"
                 />

What needs to be done

  1. Create a CE counterpart of batchCommentsDiffLineNoteFormMixin with an empty method for addReplyToReview
  2. Use ee_else_ce to import the mixin into this file.
  3. Async load the DraftNote component with:
{
  components: {
    'ee-component': () => this.renderIfEE ? import('./ee-component.vue') : import('vue_shared/compoments/empty_ce_vue_component.vue')
  }
}
  1. Keep v-else-if="!isRepliesCollapsed || !hasReplies" & @handleFormUpdateAddToReview="addReplyToReview" in CE
  2. Delete isUnresolving, it is not used in this component.
  3. Guarantee that specs exist or are added