Skip to content

Commit

Permalink
Fix notifications on cancel (#4576)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc authored Aug 1, 2024
1 parent 49ef9c2 commit 8d2b461
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions scripts/apps/users/directives/UserPreferencesDirective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,18 @@ export function UserPreferencesDirective(

scope.emailNotificationsFromExtensions = {};

for (const extension of Object.values(extensions)) {
for (const [key, value] of Object.entries(extension.activationResult.contributions?.notifications ?? [])) {
if (value.type === 'email') {
preferencesService.registerUserPreference(key, 1);
scope.emailNotificationsFromExtensions[key] = preferencesService.getSync(key);
scope.buildNotificationsFromExtensions = function() {
for (const extension of Object.values(extensions)) {
for (const [key, value] of Object.entries(extension.activationResult.contributions?.notifications ?? [])) {
if (value.type === 'email') {
preferencesService.registerUserPreference(key, 1);
scope.emailNotificationsFromExtensions[key] = preferencesService.getSync(key);
}
}
}
}
};

scope.buildNotificationsFromExtensions();

scope.toggleEmailGroupNotifications = function() {
const isGroupEnabled = scope.preferences['email:notification'].enabled;
Expand Down Expand Up @@ -290,6 +294,8 @@ export function UserPreferencesDirective(
}
});

scope.buildNotificationsFromExtensions();

// metadata service initialization is needed if its
// values object is undefined or any of the needed
// data buckets are missing in it
Expand Down

0 comments on commit 8d2b461

Please sign in to comment.