diff --git a/ui-ngx/src/app/modules/home/pages/notification/settings/notification-setting-form.component.html b/ui-ngx/src/app/modules/home/pages/notification/settings/notification-setting-form.component.html
index 752ffa367a..284cd67fa1 100644
--- a/ui-ngx/src/app/modules/home/pages/notification/settings/notification-setting-form.component.html
+++ b/ui-ngx/src/app/modules/home/pages/notification/settings/notification-setting-form.component.html
@@ -27,7 +27,7 @@
-
+
{
+ this.deliveryMethods.forEach(value => {
deliveryMethod[value] = true;
});
this.notificationSettingsFormGroup = this.fb.group(
diff --git a/ui-ngx/src/app/modules/home/pages/notification/settings/notification-settings.component.html b/ui-ngx/src/app/modules/home/pages/notification/settings/notification-settings.component.html
index 8f7a421a82..c531f10d78 100644
--- a/ui-ngx/src/app/modules/home/pages/notification/settings/notification-settings.component.html
+++ b/ui-ngx/src/app/modules/home/pages/notification/settings/notification-settings.component.html
@@ -62,7 +62,10 @@
-
+
+
diff --git a/ui-ngx/src/app/modules/home/pages/notification/settings/notification-settings.component.ts b/ui-ngx/src/app/modules/home/pages/notification/settings/notification-settings.component.ts
index 8ca3eea97a..8eac5d638d 100644
--- a/ui-ngx/src/app/modules/home/pages/notification/settings/notification-settings.component.ts
+++ b/ui-ngx/src/app/modules/home/pages/notification/settings/notification-settings.component.ts
@@ -25,7 +25,7 @@ import { ActivatedRoute } from '@angular/router';
import { deepClone, isDefinedAndNotNull } from '@core/utils';
import {
NotificationDeliveryMethod,
- NotificationDeliveryMethodTranslateMap, NotificationSettingsDeliveryMethod,
+ NotificationDeliveryMethodTranslateMap,
NotificationUserSettings
} from '@shared/models/notification.models';
import { NotificationService } from '@core/http/notification.service';
@@ -40,7 +40,7 @@ export class NotificationSettingsComponent extends PageComponent implements OnIn
notificationSettings: UntypedFormGroup;
- notificationDeliveryMethods = Object.values(NotificationSettingsDeliveryMethod);
+ notificationDeliveryMethods: NotificationDeliveryMethod[];
notificationDeliveryMethodTranslateMap = NotificationDeliveryMethodTranslateMap;
allowNotificationDeliveryMethods: Array
;
@@ -55,6 +55,7 @@ export class NotificationSettingsComponent extends PageComponent implements OnIn
}
ngOnInit() {
+ this.notificationDeliveryMethods = this.getNotificationDeliveryMethods();
this.notificationService.getAvailableDeliveryMethods({ignoreLoading: true}).subscribe(allowMethods => {
this.allowNotificationDeliveryMethods = allowMethods;
@@ -64,6 +65,15 @@ export class NotificationSettingsComponent extends PageComponent implements OnIn
this.patchNotificationSettings(this.route.snapshot.data.userSettings);
}
+ private getNotificationDeliveryMethods(): NotificationDeliveryMethod[] {
+ const deliveryMethods = new Set([
+ NotificationDeliveryMethod.WEB,
+ NotificationDeliveryMethod.SMS,
+ NotificationDeliveryMethod.EMAIL
+ ]);
+ return Object.values(NotificationDeliveryMethod).filter(type => deliveryMethods.has(type));
+ }
+
private buildNotificationSettingsForm() {
this.notificationSettings = this.fb.group({
prefs: this.fb.array([])
@@ -77,8 +87,8 @@ export class NotificationSettingsComponent extends PageComponent implements OnIn
preparedSettings = this.prepareNotificationSettings(settings.prefs);
preparedSettings.forEach((setting) => {
setting.enabledDeliveryMethods = Object.assign(
- setting.enabledDeliveryMethods,
- this.notificationDeliveryMethods.reduce((a, v) => ({ ...a, [v]: true}), {})
+ this.notificationDeliveryMethods.reduce((a, v) => ({ ...a, [v]: true}), {}),
+ setting.enabledDeliveryMethods
);
notificationSettingsControls.push(this.fb.control(setting, [Validators.required]));
});
diff --git a/ui-ngx/src/app/shared/models/notification.models.ts b/ui-ngx/src/app/shared/models/notification.models.ts
index c6a3253f1a..9cc3033ee7 100644
--- a/ui-ngx/src/app/shared/models/notification.models.ts
+++ b/ui-ngx/src/app/shared/models/notification.models.ts
@@ -598,9 +598,3 @@ export interface NotificationUserSetting {
enabled: boolean;
enabledDeliveryMethods: {[key: string]: boolean};
}
-
-export enum NotificationSettingsDeliveryMethod {
- WEB = 'WEB',
- SMS = 'SMS',
- EMAIL = 'EMAIL'
-}