From 0bfa59df09562336e2301b4e5f825678c60721de Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Wed, 16 Jan 2019 11:10:36 +0530 Subject: [PATCH 1/3] Debugging statements Template fix --- connect/connectNotificationServer.js | 8 ++++++-- emails/src/partials/invites.html | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/connect/connectNotificationServer.js b/connect/connectNotificationServer.js index c315321..54f2e2b 100644 --- a/connect/connectNotificationServer.js +++ b/connect/connectNotificationServer.js @@ -275,6 +275,8 @@ notificationServer.setConfig({ LOG_LEVEL: 'debug' }); // logger object used to log in parent thread // the callback is function(error, userIds), where userIds is an array of user ids to receive notifications const handler = (topic, message, logger, callback) => { + logger.trace(topic, 'topic'); + logger.trace(message, 'message'); const projectId = message.projectId; if (!projectId) { return callback(new Error('Missing projectId in the event message.')); @@ -324,12 +326,14 @@ const handler = (topic, message, logger, callback) => { // if message has userId such messages will likely need userHandle and user full name // so let's get it const ids = [message.initiatorUserId]; + logger.trace(message.userId, 'message.userId'); if (message.userId) { ids.push(message.userId); - return service.getUsersById(ids); } - return []; + return service.getUsersById(ids); + // return []; }).then((users) => { + logger.debug(users, 'users'); _.map(allNotifications, (notification) => { notification.version = eventConfig.version; notification.contents.projectName = project.name; diff --git a/emails/src/partials/invites.html b/emails/src/partials/invites.html index 8e0da62..4d2e158 100644 --- a/emails/src/partials/invites.html +++ b/emails/src/partials/invites.html @@ -30,7 +30,7 @@ - +
You are invited to join the {{projectName}} on Topcoder Connect. To join the project, please register for a Topcoder account using Register button below.You have been invited to a project by {{initiator.firstName}} {{initiator.lastName}}. To join, please register with Topcoder.
From d1ae6bbdc3ca8dbdf8ee83d1c8c14b009ef1a8a0 Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Wed, 16 Jan 2019 11:14:31 +0530 Subject: [PATCH 2/3] fixing method for logging --- connect/connectNotificationServer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/connect/connectNotificationServer.js b/connect/connectNotificationServer.js index 54f2e2b..87e9190 100644 --- a/connect/connectNotificationServer.js +++ b/connect/connectNotificationServer.js @@ -275,8 +275,8 @@ notificationServer.setConfig({ LOG_LEVEL: 'debug' }); // logger object used to log in parent thread // the callback is function(error, userIds), where userIds is an array of user ids to receive notifications const handler = (topic, message, logger, callback) => { - logger.trace(topic, 'topic'); - logger.trace(message, 'message'); + logger.debug(topic, 'topic'); + logger.debug(message, 'message'); const projectId = message.projectId; if (!projectId) { return callback(new Error('Missing projectId in the event message.')); @@ -326,7 +326,7 @@ const handler = (topic, message, logger, callback) => { // if message has userId such messages will likely need userHandle and user full name // so let's get it const ids = [message.initiatorUserId]; - logger.trace(message.userId, 'message.userId'); + logger.debug(message.userId, 'message.userId'); if (message.userId) { ids.push(message.userId); } From 945ba694f0c3caa1a1e3c60fbdf1039d8176ff9f Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Wed, 16 Jan 2019 11:18:28 +0530 Subject: [PATCH 3/3] Fixed issue with missing user names for messaging notifications --- connect/connectNotificationServer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/connect/connectNotificationServer.js b/connect/connectNotificationServer.js index 87e9190..4815a93 100644 --- a/connect/connectNotificationServer.js +++ b/connect/connectNotificationServer.js @@ -340,8 +340,8 @@ const handler = (topic, message, logger, callback) => { notification.contents.timestamp = (new Date()).toISOString(); // if found a user then add user handle if (users.length) { - const affectedUser = _.find(users, u => u.userId === message.userId); - const initiatorUser = _.find(users, u => u.userId === message.initiatorUserId); + const affectedUser = _.find(users, u => `${u.userId}` === message.userId); + const initiatorUser = _.find(users, u => `${u.userId}` === message.initiatorUserId); if (affectedUser) { notification.contents.userHandle = affectedUser.handle; notification.contents.userFullName = `${affectedUser.firstName} ${affectedUser.lastName}`;