From 7da15e9933f0062d1495fcda32f722e9e9daff9e Mon Sep 17 00:00:00 2001 From: Ramin Date: Sun, 5 May 2024 14:38:09 +0330 Subject: [PATCH 1/2] Make sure Ortto is merging by userID, not email #1494 --- src/services/notificationService.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/services/notificationService.ts b/src/services/notificationService.ts index c712ec2..715369c 100644 --- a/src/services/notificationService.ts +++ b/src/services/notificationService.ts @@ -156,6 +156,12 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES logger.debug('activityCreator() invalid ORTTO_EVENT_NAMES', orttoEventName) return; } + const merge_by = []; + if (process.env.ENVIRONMENT === 'production') { + merge_by.push("str:cm:userid") + } else { + merge_by.push("str::email") + } return { activities: [ { @@ -163,7 +169,8 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES attributes, fields, } - ] + ], + merge_by }; } From a3d6d4a20f2bb2d90a57f1585c4c77c4ad5cec95 Mon Sep 17 00:00:00 2001 From: Ramin Date: Sun, 5 May 2024 16:15:21 +0330 Subject: [PATCH 2/2] add userid to all ortto calls --- src/services/notificationService.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/services/notificationService.ts b/src/services/notificationService.ts index 715369c..98f41c8 100644 --- a/src/services/notificationService.ts +++ b/src/services/notificationService.ts @@ -21,6 +21,7 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES } if (process.env.ENVIRONMENT === 'production') { fields['str:cm:user-id'] = payload.userId?.toString() + fields['str:cm:userid'] = payload.userId?.toString() } let attributes; switch (orttoEventName) { @@ -60,6 +61,7 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES "str:cm:projectlink": payload.projectLink, "bol:cm:verified": payload.verified, "str:cm:transactionlink": payload.transactionLink, + "str:cm:userid": payload.userId?.toString(), }; break case NOTIFICATIONS_EVENT_NAMES.DRAFTED_PROJECT_ACTIVATED: @@ -69,6 +71,7 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES "str:cm:projectlink": payload.projectLink, "str:cm:firstname": payload.firstName, "str:cm:lastname": payload.lastName, + "str:cm:userid": payload.userId?.toString(), }; break case NOTIFICATIONS_EVENT_NAMES.PROJECT_LISTED: @@ -76,6 +79,7 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES "str:cm:projecttitle": payload.title, "str:cm:email": payload.email, "str:cm:projectlink": payload.projectLink, + "str:cm:userid": payload.userId?.toString(), }; break case NOTIFICATIONS_EVENT_NAMES.PROJECT_UNLISTED: @@ -83,6 +87,7 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES "str:cm:projecttitle": payload.title, "str:cm:email": payload.email, "str:cm:projectlink": payload.projectLink, + "str:cm:userid": payload.userId?.toString(), }; break case NOTIFICATIONS_EVENT_NAMES.PROJECT_CANCELLED: @@ -90,6 +95,7 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES "str:cm:projecttitle": payload.title, "str:cm:email": payload.email, "str:cm:projectlink": payload.projectLink, + "str:cm:userid": payload.userId?.toString(), }; break case NOTIFICATIONS_EVENT_NAMES.PROJECT_UPDATE_ADDED_OWNER: @@ -97,6 +103,7 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES "str:cm:projecttitle": payload.title, "str:cm:email": payload.email, "str:cm:projectupdatelink": payload.projectLink + '?tab=updates', + "str:cm:userid": payload.userId?.toString(), }; break case NOTIFICATIONS_EVENT_NAMES.PROJECT_VERIFIED: @@ -105,6 +112,7 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES "str:cm:email": payload.email, "str:cm:projectlink": payload.projectLink, "str:cm:verified-status": 'verified', + "str:cm:userid": payload.userId?.toString(), }; break case NOTIFICATIONS_EVENT_NAMES.VERIFICATION_FORM_REJECTED: @@ -113,6 +121,7 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES "str:cm:email": payload.email, "str:cm:projectlink": payload.projectLink, "str:cm:verified-status": 'rejected', + "str:cm:userid": payload.userId?.toString(), }; break case NOTIFICATIONS_EVENT_NAMES.PROJECT_UNVERIFIED: @@ -121,6 +130,7 @@ const activityCreator = (payload: any, orttoEventName: NOTIFICATIONS_EVENT_NAMES "str:cm:email": payload.email, "str:cm:projectlink": payload.projectLink, "str:cm:verified-status": 'rejected', + "str:cm:userid": payload.userId?.toString(), }; break case NOTIFICATIONS_EVENT_NAMES.PROJECT_BADGE_REVOKED: