diff --git a/scripts/apps/users/directives/UserPreferencesDirective.ts b/scripts/apps/users/directives/UserPreferencesDirective.ts index ece1d5a62a..bf3c213f3d 100644 --- a/scripts/apps/users/directives/UserPreferencesDirective.ts +++ b/scripts/apps/users/directives/UserPreferencesDirective.ts @@ -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; @@ -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