From c2e382ec7383d61e5449453c226e91abaa8e4571 Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Tue, 5 Sep 2023 18:23:03 +0300 Subject: [PATCH 1/3] DM-370: wip --- .../notifications-screen.component.ts | 10 +++++++++- apps/red-ui/src/app/services/notifications.service.ts | 5 ----- apps/red-ui/src/assets/config/config.json | 10 +++++----- 3 files changed, 14 insertions(+), 11 deletions(-) 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..0b0be7f6a 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 @@ -77,7 +77,15 @@ export class NotificationsScreenComponent extends BaseFormComponent implements O async save() { this.#loadingService.start(); try { - await firstValueFrom(this.#notificationPreferencesService.update(this.form.value)); + const preferences = this.isPreferenceChecked('inAppNotifications', 'ASSIGN_APPROVER') + ? this.form.value + : { + ...this.form.value, + inAppNotifications: this.form + .get('inAppNotifications') + .value.filter((preference: string) => !RSS_EXCLUDED_SETTINGS.includes(preference)), + }; + await firstValueFrom(this.#notificationPreferencesService.update(preferences)); } catch (e) { this.#toaster.error(_('notifications-screen.error.generic')); } 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, From dad25c7c2efc7d9913b1bfff55f8a80011adf797 Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Tue, 5 Sep 2023 18:27:26 +0300 Subject: [PATCH 2/3] DM-370: added documine condition --- .../notifications-screen.component.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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 0b0be7f6a..637c3e69e 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 @@ -77,14 +77,15 @@ export class NotificationsScreenComponent extends BaseFormComponent implements O async save() { this.#loadingService.start(); try { - const preferences = this.isPreferenceChecked('inAppNotifications', 'ASSIGN_APPROVER') - ? this.form.value - : { - ...this.form.value, - inAppNotifications: this.form - .get('inAppNotifications') - .value.filter((preference: string) => !RSS_EXCLUDED_SETTINGS.includes(preference)), - }; + const preferences = + !this.isPreferenceChecked('inAppNotifications', 'ASSIGN_APPROVER') && this.#config.IS_DOCUMINE + ? { + ...this.form.value, + inAppNotifications: this.form + .get('inAppNotifications') + .value.filter((preference: string) => !RSS_EXCLUDED_SETTINGS.includes(preference)), + } + : this.form.value; await firstValueFrom(this.#notificationPreferencesService.update(preferences)); } catch (e) { this.#toaster.error(_('notifications-screen.error.generic')); From 96c16f383295ca3b0391c9bb94be7a98476eb06b Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Thu, 7 Sep 2023 16:16:21 +0300 Subject: [PATCH 3/3] DM-370: Fixed assign notifications not showing. --- .../notifications-screen.component.ts | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) 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 637c3e69e..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,15 +78,7 @@ export class NotificationsScreenComponent extends BaseFormComponent implements O async save() { this.#loadingService.start(); try { - const preferences = - !this.isPreferenceChecked('inAppNotifications', 'ASSIGN_APPROVER') && this.#config.IS_DOCUMINE - ? { - ...this.form.value, - inAppNotifications: this.form - .get('inAppNotifications') - .value.filter((preference: string) => !RSS_EXCLUDED_SETTINGS.includes(preference)), - } - : this.form.value; + const preferences = this.#filterNotificationPreferences(); await firstValueFrom(this.#notificationPreferencesService.update(preferences)); } catch (e) { this.#toaster.error(_('notifications-screen.error.generic')); @@ -115,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; + } }