From 9498198e468d00fab0aa2892a605d7f8103d29b4 Mon Sep 17 00:00:00 2001 From: Maksym Mykhailenko Date: Wed, 2 Oct 2019 17:05:28 +0800 Subject: [PATCH 1/2] fix: error when message doesn't have initiatorUserId So far I guess we don't have such a case as there were no issues raised. But if some messages don't have initiatorUserId, there would be an error during requesting user details. --- connect/connectNotificationServer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/connect/connectNotificationServer.js b/connect/connectNotificationServer.js index 4cc98be..34674e3 100644 --- a/connect/connectNotificationServer.js +++ b/connect/connectNotificationServer.js @@ -451,9 +451,13 @@ const handler = (topic, message, logger, callback) => { logger.debug('filtered notifications: ', allNotifications); // now let's retrieve some additional data + const ids = []; + logger.debug(message.initiatorUserId, 'message.initiatorUserId'); + if (message.initiatorUserId) { + ids.push(message.initiatorUserId); + } // if message has userId such messages will likely need userHandle and user full name // so let's get it - const ids = [message.initiatorUserId]; logger.debug(message.userId, 'message.userId'); if (message.userId) { ids.push(message.userId); From ed4d286f49fd48bf8ad7c459e6763316e56cf11e Mon Sep 17 00:00:00 2001 From: Maksym Mykhailenko Date: Wed, 2 Oct 2019 17:07:30 +0800 Subject: [PATCH 2/2] fix: notification emails showing same user name multiple times ref issue tracked in Connect App repo https://github.com/appirio-tech/connect-app/issues/3216 --- connect/notificationServices/email.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connect/notificationServices/email.js b/connect/notificationServices/email.js index bc01406..3d608fc 100644 --- a/connect/notificationServices/email.js +++ b/connect/notificationServices/email.js @@ -24,7 +24,7 @@ function replacePlaceholders(term, data) { let ret = term; if (placeholders && placeholders.length) { _(placeholders).each(p => { - const values = _.map(data, p.slice(1, -1)); + const values = _.uniq(_.map(data, p.slice(1, -1))); // TODO remove this code if possible. // This code appears to be not in use causing lint errors. // For now I'm commenting it, in case it contains some valuable logic.