Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ module.exports = {
API_CONTEXT_PATH: process.env.API_CONTEXT_PATH || '/v5/notifications',
TC_API_BASE_URL: process.env.TC_API_BASE_URL || '',

// CloudFront CDN URL. It's used to host and resize images like user avatars.
TC_CDN_URL: process.env.TC_CDN_URL || '',

// Configuration for generating machine to machine auth0 token.
// The token will be used for calling another internal API.
AUTH0_URL: process.env.AUTH0_URL,
Expand Down
3 changes: 3 additions & 0 deletions connect/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = {
// size for user photos in emails
EMAIL_USER_PHOTO_SIZE: 80,

// periods of time in cron format (node-cron)
SCHEDULED_EVENT_PERIOD: {
every10minutes: '*/10 * * * *',
Expand Down
4 changes: 3 additions & 1 deletion connect/notificationServices/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const {
SCHEDULED_EVENT_PERIOD,
SETTINGS_EMAIL_SERVICE_ID,
ACTIVE_USER_STATUSES,
EMAIL_USER_PHOTO_SIZE,
} = require('../constants');
const { EVENT_BUNDLES } = require('../events-config');
const helpers = require('../helpers');
Expand Down Expand Up @@ -236,7 +237,8 @@ function handler(topicName, messageJSON, notification) {
projectId: messageJSON.projectId,
authorHandle: notification.contents.userHandle,
authorFullName: notification.contents.userFullName,
photoURL: notification.contents.photoURL,
photoURL: `${config.TC_CDN_URL}/avatar/${encodeURIComponent(notification.contents.photoURL)}`
+ `?size=${EMAIL_USER_PHOTO_SIZE}`,
type: notificationType,
emailToAffectedUser: notification.contents.userEmail === userEmail,
},
Expand Down