Skip to content

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

The file `` has differences between CE and EE.

Differences

diff --git a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/assets/javascripts/notes/components/noteable_note.vue b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/assets/javascripts/notes/components/noteable_note.vue
index 3c48d81ed05..8077d63f663 100644
--- a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/assets/javascripts/notes/components/noteable_note.vue
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/assets/javascripts/notes/components/noteable_note.vue
@@ -145,12 +145,16 @@ export default {
       this.$refs.noteBody.resetAutoSave();
       this.$emit('updateSuccess');
     },
-    formUpdateHandler(noteText, parentElement, callback) {
+    formUpdateHandler(noteText, parentElement, callback, resolveDiscussion) {
       this.$emit('handleUpdateNote', {
         note: this.note,
         noteText,
+        resolveDiscussion,
         callback: () => this.updateSuccess(),
       });
+
+      if (this.note.isDraft) return;
+
       const data = {
         endpoint: this.note.path,
         note: {
@@ -223,6 +227,7 @@ export default {
     <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-if="commit" v-html="actionText"></span>
           <span v-else class="d-none d-sm-inline">&middot;</span>
         </note-header>
@@ -235,12 +240,16 @@ export default {
           :can-award-emoji="note.current_user.can_award_emoji"
           :can-delete="note.current_user.can_edit"
           :can-report-as-abuse="canReportAsAbuse"
-          :can-resolve="note.current_user.can_resolve"
+          :can-resolve="
+            note.current_user.can_resolve || (note.isDraft && note.discussion_id !== null)
+          "
           :report-abuse-path="note.report_abuse_path"
-          :resolvable="note.resolvable"
-          :is-resolved="note.resolved"
+          :resolvable="note.resolvable || note.isDraft"
+          :is-resolved="note.resolved || note.resolve_discussion"
           :is-resolving="isResolving"
           :resolved-by="note.resolved_by"
+          :discussion-id="note.isDraft && note.discussion_id"
+          :resolve-discussion="note.isDraft && note.resolve_discussion"
           @handleEdit="editHandler"
           @handleDelete="deleteHandler"
           @handleResolve="resolveHandler"

What needs to be done Guarantee that specs exist or are added

  1. Create a mixin in ee/ folder
  2. Create a backport for CE
  3. Use ee_else_ce to import the mixin into this file.
  4. Move the script tags differences into the mixins
  5. Create computed properties in the mixins to handle the following differences:
 :can-resolve="note.current_user.can_resolve"
+          :can-resolve="
+            note.current_user.can_resolve || (note.isDraft && note.discussion_id !== null)
+          "
           :report-abuse-path="note.report_abuse_path"
-          :resolvable="note.resolvable"
-          :is-resolved="note.resolved"
+          :resolvable="note.resolvable || note.isDraft"
+          :is-resolved="note.resolved || note.resolve_discussion"
           :is-resolving="isResolving"
           :resolved-by="note.resolved_by"
+          :discussion-id="note.isDraft && note.discussion_id"
+          :resolve-discussion="note.isDraft && note.resolve_discussion"
  1. Add a v-if with renderIfExists to <slot slot="note-header-info" name="note-header-info"></slot>
  2. Guarantee that specs exist or are added