Skip to content

Commit cb65347

Browse files
author
Maksym Mykhailenko
committed
Revert "fix: don't reassign event data"
This reverts commit dc13318.
1 parent dc13318 commit cb65347

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

connect/notificationServices/email.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,19 @@ function handler(topicName, messageJSON, notification) {
229229
const categories = [`${config.ENV}:${eventType}`.toLowerCase()];
230230

231231
const eventMessage = {
232-
data: {},
232+
data: {
233+
name: user.firstName + ' ' + user.lastName,
234+
handle: user.handle,
235+
date: (new Date()).toISOString(),
236+
projectName: notification.contents.projectName,
237+
projectId: messageJSON.projectId,
238+
authorHandle: notification.contents.userHandle,
239+
authorFullName: notification.contents.userFullName,
240+
photoURL: `${config.TC_CDN_URL}/avatar/${encodeURIComponent(notification.contents.photoURL)}`
241+
+ `?size=${EMAIL_USER_PHOTO_SIZE}`,
242+
type: notificationType,
243+
emailToAffectedUser: notification.contents.userEmail === userEmail,
244+
},
233245
recipients,
234246
version: 'v3',
235247
from: {
@@ -238,21 +250,8 @@ function handler(topicName, messageJSON, notification) {
238250
},
239251
categories,
240252
};
241-
// first we put `notification.contents` to the `data`, so we would reassign any values there
242-
_.assign(eventMessage.data, notification.contents, {
243-
name: user.firstName + ' ' + user.lastName,
244-
handle: user.handle,
245-
date: (new Date()).toISOString(),
246-
projectName: notification.contents.projectName,
247-
projectId: messageJSON.projectId,
248-
authorHandle: notification.contents.userHandle,
249-
authorFullName: notification.contents.userFullName,
250-
photoURL: `${config.TC_CDN_URL}/avatar/${encodeURIComponent(notification.contents.photoURL)}`
251-
+ `?size=${EMAIL_USER_PHOTO_SIZE}`,
252-
type: notificationType,
253-
emailToAffectedUser: notification.contents.userEmail === userEmail,
254-
});
255253
eventMessage.data[eventMessage.data.type] = true;
254+
_.assign(eventMessage.data, notification.contents);
256255

257256
// message service may return tags
258257
// to understand if post notification is regarding phases or no, we will try to get phaseId from the tags

0 commit comments

Comments
 (0)