@@ -229,19 +229,7 @@ function handler(topicName, messageJSON, notification) {
229229 const categories = [ `${ config . ENV } :${ eventType } ` . toLowerCase ( ) ] ;
230230
231231 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 : { } ,
245233 recipients,
246234 version : 'v3' ,
247235 from : {
@@ -250,8 +238,21 @@ function handler(topicName, messageJSON, notification) {
250238 } ,
251239 categories,
252240 } ;
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+ } ) ;
253255 eventMessage . data [ eventMessage . data . type ] = true ;
254- _ . assign ( eventMessage . data , notification . contents ) ;
255256
256257 // message service may return tags
257258 // to understand if post notification is regarding phases or no, we will try to get phaseId from the tags
0 commit comments