Add subscription for user notes on work items
What does this MR do and why?
This MR introduces subscription on notes for a work item in order to provide real time updates on a work item when a new comment or system note is added or edited.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
- small FE patch
click for the patch
download patch here a.patch
diff --git a/app/assets/javascripts/work_items/components/work_item_detail.vue b/app/assets/javascripts/work_items/components/work_item_detail.vue
index d64d76d10c3c..034f583cb4bf 100644
--- a/app/assets/javascripts/work_items/components/work_item_detail.vue
+++ b/app/assets/javascripts/work_items/components/work_item_detail.vue
@@ -43,6 +43,9 @@ import workItemDatesSubscription from '../graphql/work_item_dates.subscription.g
import workItemTitleSubscription from '../graphql/work_item_title.subscription.graphql';
import workItemAssigneesSubscription from '../graphql/work_item_assignees.subscription.graphql';
import workItemMilestoneSubscription from '../graphql/work_item_milestone.subscription.graphql';
+import workItemDiscussionNoteAdded from '../graphql/work_item_note_created.subscription.graphql';
+import workItemDiscussionNoteRemoved from '../graphql/work_item_note_deleted.subscription.graphql';
+import workItemNoteUpdated from '../graphql/work_item_note_updated.subscription.graphql';
import updateWorkItemMutation from '../graphql/update_work_item.mutation.graphql';
import updateWorkItemTaskMutation from '../graphql/update_work_item_task.mutation.graphql';
import { getWorkItemQuery } from '../utils';
@@ -203,6 +206,39 @@ export default {
return !this.isWidgetPresent(WIDGET_TYPE_MILESTONE) || !this.workItem?.id;
},
},
+ {
+ document: workItemDiscussionNoteAdded,
+ variables() {
+ return {
+ noteableId: this.workItem.id,
+ };
+ },
+ skip() {
+ return !this.workItem?.id;
+ },
+ },
+ {
+ document: workItemDiscussionNoteRemoved,
+ variables() {
+ return {
+ noteableId: this.workItem.id,
+ };
+ },
+ skip() {
+ return !this.workItem?.id;
+ },
+ },
+ {
+ document: workItemNoteUpdated,
+ variables() {
+ return {
+ noteableId: this.workItem.id,
+ };
+ },
+ skip() {
+ return !this.workItem?.id;
+ },
+ },
],
},
},
- Video recording with how to test it:
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Alexandru Croitor