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/modules/file-preview/components/annotation-actions/annotation-actions.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html index e9bffea93..87e5bc85d 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html @@ -36,12 +36,7 @@