DM-370: Fixed assign notifications not showing.
This commit is contained in:
parent
b4892afff5
commit
96c16f3832
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user