Skip to content

Add subscription to synthetic system notes

Alexandru Croitor requested to merge graphql_synthetic_notes_subscription into master

What does this MR do and why?

This MR introduces subscription on synthetic notes for a work item, in order to provide real time updates on a work item when an event on a work item resource is created. We have synthetic system notes build for resources like: milestone, iteration, weight, labels and state.

This MR is a part 2 of an already merged notes subscriptions MR !107649 (merged)

re #385468 (closed)

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

  1. 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;
+          },
+        },
       ],
     },
   },
  1. Video recording with how to test it:

Screen_Recording_-_480

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Alexandru Croitor

Merge request reports

Loading