Merge branch 'DM-370' into 'master'
Resolve DM-370 Closes DM-370 See merge request redactmanager/red-ui!55
This commit is contained in:
commit
c0000bb60e
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,6 @@ const NOTIFICATIONS_THRESHOLD = 1000;
|
||||
export class NotificationsService extends EntitiesService<INotification, Notification> implements OnDestroy {
|
||||
readonly #config = getConfig<AppConfig>();
|
||||
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<INotification, Notific
|
||||
const todayDate = dayjs(new Date());
|
||||
|
||||
notifications = notifications.filter(n => {
|
||||
if (this.#config.IS_DOCUMINE && this.#filterDocumineNotifications.includes(n.notificationType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(n.notificationType in NotificationTypes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user