@@ -229,19 +229,7 @@ function handler(topicName, messageJSON, notification) {
229
229
const categories = [ `${ config . ENV } :${ eventType } ` . toLowerCase ( ) ] ;
230
230
231
231
const eventMessage = {
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
- } ,
232
+ data : { } ,
245
233
recipients,
246
234
version : 'v3' ,
247
235
from : {
@@ -250,8 +238,21 @@ function handler(topicName, messageJSON, notification) {
250
238
} ,
251
239
categories,
252
240
} ;
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
+ } ) ;
253
255
eventMessage . data [ eventMessage . data . type ] = true ;
254
- _ . assign ( eventMessage . data , notification . contents ) ;
255
256
256
257
// message service may return tags
257
258
// to understand if post notification is regarding phases or no, we will try to get phaseId from the tags
0 commit comments