Merge branch 'master' into VM/DM-358
This commit is contained in:
commit
44502ea400
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,12 +36,7 @@
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="annotationActionsService.editRedaction(annotations)"
|
||||
*ngIf="
|
||||
annotationPermissions.canChangeLegalBasis ||
|
||||
annotationPermissions.canRecategorizeAnnotation ||
|
||||
annotationPermissions.canForceRedaction ||
|
||||
annotationPermissions.canForceHint
|
||||
"
|
||||
*ngIf="canEdit"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
[tooltip]="'annotation-actions.edit-redaction.label' | translate"
|
||||
[type]="buttonType"
|
||||
|
||||
@ -38,6 +38,7 @@ export class AnnotationActionsComponent implements OnChanges {
|
||||
const hidden = this._annotationManager.hidden();
|
||||
return this.#annotations.reduce((acc, annotation) => !hidden.has(annotation.id) && acc, true);
|
||||
});
|
||||
readonly #isDocumine = getConfig().IS_DOCUMINE;
|
||||
|
||||
constructor(
|
||||
readonly viewModeService: ViewModeService,
|
||||
@ -55,6 +56,15 @@ export class AnnotationActionsComponent implements OnChanges {
|
||||
return this.#annotations;
|
||||
}
|
||||
|
||||
get canEdit() {
|
||||
const canEditRedactions =
|
||||
this.annotationPermissions.canChangeLegalBasis ||
|
||||
this.annotationPermissions.canRecategorizeAnnotation ||
|
||||
this.annotationPermissions.canForceHint ||
|
||||
this.annotationPermissions.canForceRedaction;
|
||||
return this.#isDocumine && this.annotations.length > 1 ? this.annotationPermissions.canEditAnnotations : canEditRedactions;
|
||||
}
|
||||
|
||||
@Input()
|
||||
set annotations(annotations: AnnotationWrapper[]) {
|
||||
this.#annotations = annotations.filter(a => a !== undefined);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
"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