diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.ts b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.ts index a6a2b4fe5..1f80c321c 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.ts +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.ts @@ -4,6 +4,7 @@ import { NotificationPreferencesService } from '../../../services/notification-p import { BaseFormComponent, getConfig, LoadingService, Toaster } from '@iqser/common-ui'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { + DocumentNotificationsTypes, NotificationCategoriesValues, NotificationGroupsKeys, NotificationGroupsValues, @@ -77,7 +78,8 @@ export class NotificationsScreenComponent extends BaseFormComponent implements O async save() { this.#loadingService.start(); try { - await firstValueFrom(this.#notificationPreferencesService.update(this.form.value)); + const preferences = this.#filterNotificationPreferences(); + await firstValueFrom(this.#notificationPreferencesService.update(preferences)); } catch (e) { this.#toaster.error(_('notifications-screen.error.generic')); } @@ -106,4 +108,27 @@ export class NotificationsScreenComponent extends BaseFormComponent implements O this.#loadingService.stop(); } + + #filterNotificationPreferences() { + if (!this.#config.IS_DOCUMINE) { + return this.form.value; + } + + if (!this.isPreferenceChecked('inAppNotifications', DocumentNotificationsTypes.assignApprover)) { + return { + ...this.form.value, + inAppNotifications: this.form + .get('inAppNotifications') + .value.filter((preference: string) => !RSS_EXCLUDED_SETTINGS.includes(preference)), + }; + } + if (!this.form.get('inAppNotifications').value.includes(DocumentNotificationsTypes.assignReviewer)) { + return { + ...this.form.value, + inAppNotifications: [...this.form.get('inAppNotifications').value, DocumentNotificationsTypes.assignReviewer], + }; + } + + return this.form.value; + } } diff --git a/apps/red-ui/src/app/services/notifications.service.ts b/apps/red-ui/src/app/services/notifications.service.ts index 6e1a91769..c5fb6477e 100644 --- a/apps/red-ui/src/app/services/notifications.service.ts +++ b/apps/red-ui/src/app/services/notifications.service.ts @@ -25,7 +25,6 @@ const NOTIFICATIONS_THRESHOLD = 1000; export class NotificationsService extends EntitiesService implements OnDestroy { readonly #config = getConfig(); readonly #subscription = new Subscription(); - readonly #filterDocumineNotifications: string[] = [NotificationTypes.ASSIGN_REVIEWER]; protected readonly _defaultModelPath = 'notification'; protected readonly _entityClass = Notification; @@ -119,10 +118,6 @@ export class NotificationsService extends EntitiesService { - if (this.#config.IS_DOCUMINE && this.#filterDocumineNotifications.includes(n.notificationType)) { - return false; - } - if (!(n.notificationType in NotificationTypes)) { return false; } diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index 42bf5941f..2ccc6f6d1 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -1,9 +1,9 @@ { "ADMIN_CONTACT_NAME": null, "ADMIN_CONTACT_URL": null, - "API_URL": "https://dan.iqser.cloud", + "API_URL": "https://frontend2.iqser.cloud", "APP_NAME": "RedactManager", - "IS_DOCUMINE": false, + "IS_DOCUMINE": true, "RULE_EDITOR_DEV_ONLY": false, "AUTO_READ_TIME": 3, "BACKEND_APP_VERSION": "4.4.40", @@ -13,13 +13,13 @@ "MAX_RETRIES_ON_SERVER_ERROR": 3, "OAUTH_CLIENT_ID": "redaction", "OAUTH_IDP_HINT": null, - "OAUTH_URL": "https://dan.iqser.cloud/auth", + "OAUTH_URL": "https://frontend2.iqser.cloud/auth", "RECENT_PERIOD_IN_HOURS": 24, "SELECTION_MODE": "structural", "MANUAL_BASE_URL": "https://docs.redactmanager.com/preview", "ANNOTATIONS_THRESHOLD": 1000, - "THEME": "redact", - "BASE_TRANSLATIONS_DIRECTORY": "/assets/i18n/redact/", + "THEME": "scm", + "BASE_TRANSLATIONS_DIRECTORY": "/assets/i18n/scm/", "AVAILABLE_NOTIFICATIONS_DAYS": 30, "AVAILABLE_OLD_NOTIFICATIONS_MINUTES": 60, "NOTIFICATIONS_THRESHOLD": 1000,