Skip to content

Commit

Permalink
Merge pull request #154 from alkem-io/develop
Browse files Browse the repository at this point in the history
Release: User Registered Notification for Global Hub Admins
  • Loading branch information
valentinyanakiev authored Oct 27, 2022
2 parents d3641f2 + ae05431 commit 89f9210
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
3 changes: 3 additions & 0 deletions notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ recipients:
- rule:
type: GLOBAL_ADMIN
resource_id:
- rule:
type: GLOBAL_ADMIN_HUBS
resource_id:
- name: registrant
rules:
- rule:
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alkemio-notifications",
"version": "0.5.9",
"version": "0.5.10",
"description": "Alkemio notifications service",
"author": "Alkemio Foundation",
"private": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class NotificationBuilder<
): Promise<NotificationTemplateType[]> {
const { templateType, roleConfig, templateVariables } = options;
this.logger.verbose?.(
`Building notifications with [${emailTemplate}] for '${recipientRole}'`,
`[${emailTemplate} - '${recipientRole}'] Building notifications - start'`,
LogContext.NOTIFICATIONS
);

Expand Down Expand Up @@ -168,7 +168,11 @@ export class NotificationBuilder<
}

this.logger.verbose?.(
`Identified ${recipients.length} recipients to be filtered by preferences`,
`[${emailTemplate} - '${recipientRole}'] ...${
recipients.length
} recipients have matching credentials: ${JSON.stringify(
recipients.map(user => user.email)
)}`,
LogContext.NOTIFICATIONS
);

Expand All @@ -187,14 +191,14 @@ export class NotificationBuilder<

if (!targetedUserPreference) {
this.logger.verbose?.(
`Skipping recipient ${recipient.nameID} - ${extra.rolePreferenceType} preference not found`
`[${emailTemplate} - '${recipientRole}'] ...skipping recipient ${recipient.nameID} - ${extra.rolePreferenceType} preference not found`
);
continue;
}

if (targetedUserPreference.value !== 'true') {
this.logger.verbose?.(
`User ${recipient.displayName} filtered out because of ${extra?.rolePreferenceType}`,
`[${emailTemplate} - '${recipientRole}'] User ${recipient.displayName} filtered out because of ${extra?.rolePreferenceType}`,
LogContext.NOTIFICATIONS
);
continue;
Expand All @@ -205,7 +209,11 @@ export class NotificationBuilder<
}

this.logger.verbose?.(
`Notifications with [${emailTemplate}] for role ${recipientRole} - identified ${filteredRecipients.length} recipients`,
`[${emailTemplate} - '${recipientRole}'] ...${
filteredRecipients.length
} recipients with valid credentials have preference enabled: ${JSON.stringify(
filteredRecipients.map(user => user.email)
)}`,
LogContext.NOTIFICATIONS
);

Expand All @@ -219,7 +227,7 @@ export class NotificationBuilder<
);

this.logger.verbose?.(
`Building notifications for [${emailTemplate}] - completed`,
`[${emailTemplate} - '${recipientRole}'] ...building notifications - completed`,
LogContext.NOTIFICATIONS
);

Expand Down

0 comments on commit 89f9210

Please sign in to comment.