Skip to content

Commit a090b60

Browse files
author
Vikas Agarwal
committed
Handling bundle period settings per notification group.
1 parent 8f6e857 commit a090b60

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

connect/notificationServices/email.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,18 +279,15 @@ function handler(topicName, messageJSON, notification) {
279279
}
280280

281281
// if notifications has to be bundled
282-
let bundlingEnabled = _.get(settings, `notifications['${notificationType}'].${SETTINGS_EMAIL_BUNDLING_SERVICE_ID}.enabled`);
283-
let bundlePeriod = _.get(settings, `services.${SETTINGS_EMAIL_SERVICE_ID}.bundlePeriod`);
282+
let bundlePeriod = _.get(settings, `notifications['${notificationType}'].${SETTINGS_EMAIL_SERVICE_ID}.bundlePeriod`);
284283
// if bundling is not explicitly set and the event is not a messaging event, assume bundling enabled
285-
if (!bundlingEnabled && !messagingEvent) {
286-
bundlingEnabled = 'yes';
284+
if (!bundlePeriod && !messagingEvent) {
287285
// if bundle period is not set, assume it to be daily for default case
288286
bundlePeriod = !bundlePeriod ? 'daily' : bundlePeriod;
289287
}
290-
logger.debug('bundlingEnabled=>', bundlingEnabled);
291288
logger.debug('bundlePeriod=>', bundlePeriod);
292289

293-
if (bundlingEnabled === 'yes' && bundlePeriod) {
290+
if (bundlePeriod) {
294291
if (!SCHEDULED_EVENT_PERIOD[bundlePeriod]) {
295292
throw new Error(`User's '${notification.userId}' setting for service`
296293
+ ` '${SETTINGS_EMAIL_SERVICE_ID}' option 'bundlePeriod' has unsupported value '${bundlePeriod}'.`);

0 commit comments

Comments
 (0)