From 6b3d7874adfd2533a563099c10bae6f87a2e8078 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Wed, 5 Apr 2023 12:39:07 +0800 Subject: [PATCH 1/2] Disable push notification action in rules engine --- packages/rule-handler/src/rule.ts | 39 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/packages/rule-handler/src/rule.ts b/packages/rule-handler/src/rule.ts index a1a2f898b..f7a9b799c 100644 --- a/packages/rule-handler/src/rule.ts +++ b/packages/rule-handler/src/rule.ts @@ -1,9 +1,8 @@ -import { NotificationData, sendNotification } from './notification' -import { getAuthToken, PubSubData } from './index' import axios, { AxiosResponse } from 'axios' +import { filterPage } from './filter' +import { getAuthToken, PubSubData } from './index' import { setLabels } from './label' import { archivePage, markPageAsRead } from './page' -import { filterPage } from './filter' export enum RuleActionType { AddLabel = 'ADD_LABEL', @@ -141,25 +140,25 @@ export const triggerActions = async ( filteredPage.readingProgressPercent < 100 && actionPromises.push(markPageAsRead(apiEndpoint, authToken, data.id)) ) - case RuleActionType.SendNotification: { - const data: NotificationData = { - title: 'New page added to your library', - body: filteredPage.title, - image: filteredPage.image || undefined, - } + // case RuleActionType.SendNotification: { + // const data: NotificationData = { + // title: 'New page added to your library', + // body: filteredPage.title, + // image: filteredPage.image || undefined, + // } - const params = action.params - if (params.length > 0) { - const param = JSON.parse(params[0]) as NotificationData - data.body = param.body || data.body - data.title = param.title || data.title - data.image = param.image || data.image - } + // const params = action.params + // if (params.length > 0) { + // const param = JSON.parse(params[0]) as NotificationData + // data.body = param.body || data.body + // data.title = param.title || data.title + // data.image = param.image || data.image + // } - return actionPromises.push( - sendNotification(apiEndpoint, authToken, data) - ) - } + // return actionPromises.push( + // sendNotification(apiEndpoint, authToken, data) + // ) + // } } }) } From f65f8202db6c40566b868596607418083a848707 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Wed, 5 Apr 2023 12:39:23 +0800 Subject: [PATCH 2/2] Disable push notification action in rules web --- packages/web/lib/networking/queries/useGetRulesQuery.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web/lib/networking/queries/useGetRulesQuery.tsx b/packages/web/lib/networking/queries/useGetRulesQuery.tsx index c193196b0..ffd1cbab5 100644 --- a/packages/web/lib/networking/queries/useGetRulesQuery.tsx +++ b/packages/web/lib/networking/queries/useGetRulesQuery.tsx @@ -11,7 +11,7 @@ export enum RuleActionType { AddLabel = 'ADD_LABEL', Archive = 'ARCHIVE', MarkAsRead = 'MARK_AS_READ', - SendNotification = 'SEND_NOTIFICATION', + // SendNotification = 'SEND_NOTIFICATION', } export interface Rule {