Move EE differences for `app/assets/javascripts/notes/components/note_body.vue`
The file app/assets/javascripts/notes/components/note_body.vue has differences between CE and EE.
Diferences
diff --git a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/assets/javascripts/notes/components/note_body.vue b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/assets/javascripts/notes/components/note_body.vue
index bcf5d334da4..82b6cd35ec2 100644
--- a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/assets/javascripts/notes/components/note_body.vue
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/assets/javascripts/notes/components/note_body.vue
@@ -1,5 +1,5 @@
<script>
-import { mapActions } from 'vuex';
+import { mapGetters, mapActions } from 'vuex';
import $ from 'jquery';
import noteEditedText from './note_edited_text.vue';
import noteAwardsList from './note_awards_list.vue';
@@ -43,6 +43,7 @@ export default {
},
},
computed: {
+ ...mapGetters(['getDiscussion']),
noteBody() {
return this.note.note;
},
@@ -52,6 +53,11 @@ export default {
lineType() {
return this.line ? this.line.type : null;
},
+ discussion() {
+ if (!this.note.isDraft) return {};
+
+ return this.getDiscussion(this.note.discussion_id);
+ },
},
mounted() {
this.renderGFM();
@@ -76,8 +82,8 @@ export default {
renderGFM() {
$(this.$refs['note-body']).renderGFM();
},
- handleFormUpdate(note, parentElement, callback) {
- this.$emit('handleFormUpdate', note, parentElement, callback);
+ handleFormUpdate(note, parentElement, callback, resolveDiscussion) {
+ this.$emit('handleFormUpdate', note, parentElement, callback, resolveDiscussion);
},
formCancelHandler(shouldConfirm, isDirty) {
this.$emit('cancelForm', shouldConfirm, isDirty);
@@ -112,6 +118,8 @@ export default {
:note="note"
:help-page-path="helpPagePath"
:markdown-version="note.cached_markdown_version"
+ :discussion="discussion"
+ :resolve-discussion="note.resolve_discussion"
@handleFormUpdate="handleFormUpdate"
@cancelForm="formCancelHandler"
/>
What needs to be done
- Create a EE mixin in the
/eefolder for the differences in the script tag. - Create a CE counterpart of that mixin with a computed prop for
discussionthat returns an empty object and thehandleFormUpdate - Create a computed prop for
note.resolve_discussionin both mixins, the one in CE should be empty. - Move the template differences to CE
- Guarantee that specs exist or are added