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