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 { BaseFormComponent, getConfig, LoadingService, Toaster } from '@iqser/common-ui';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import {
|
import {
|
||||||
|
DocumentNotificationsTypes,
|
||||||
NotificationCategoriesValues,
|
NotificationCategoriesValues,
|
||||||
NotificationGroupsKeys,
|
NotificationGroupsKeys,
|
||||||
NotificationGroupsValues,
|
NotificationGroupsValues,
|
||||||
@ -77,7 +78,8 @@ export class NotificationsScreenComponent extends BaseFormComponent implements O
|
|||||||
async save() {
|
async save() {
|
||||||
this.#loadingService.start();
|
this.#loadingService.start();
|
||||||
try {
|
try {
|
||||||
await firstValueFrom(this.#notificationPreferencesService.update(this.form.value));
|
const preferences = this.#filterNotificationPreferences();
|
||||||
|
await firstValueFrom(this.#notificationPreferencesService.update(preferences));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.#toaster.error(_('notifications-screen.error.generic'));
|
this.#toaster.error(_('notifications-screen.error.generic'));
|
||||||
}
|
}
|
||||||
@ -106,4 +108,27 @@ export class NotificationsScreenComponent extends BaseFormComponent implements O
|
|||||||
|
|
||||||
this.#loadingService.stop();
|
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
|
<iqser-circle-button
|
||||||
(action)="annotationActionsService.editRedaction(annotations)"
|
(action)="annotationActionsService.editRedaction(annotations)"
|
||||||
*ngIf="
|
*ngIf="canEdit"
|
||||||
annotationPermissions.canChangeLegalBasis ||
|
|
||||||
annotationPermissions.canRecategorizeAnnotation ||
|
|
||||||
annotationPermissions.canForceRedaction ||
|
|
||||||
annotationPermissions.canForceHint
|
|
||||||
"
|
|
||||||
[tooltipPosition]="tooltipPosition"
|
[tooltipPosition]="tooltipPosition"
|
||||||
[tooltip]="'annotation-actions.edit-redaction.label' | translate"
|
[tooltip]="'annotation-actions.edit-redaction.label' | translate"
|
||||||
[type]="buttonType"
|
[type]="buttonType"
|
||||||
|
|||||||
@ -38,6 +38,7 @@ export class AnnotationActionsComponent implements OnChanges {
|
|||||||
const hidden = this._annotationManager.hidden();
|
const hidden = this._annotationManager.hidden();
|
||||||
return this.#annotations.reduce((acc, annotation) => !hidden.has(annotation.id) && acc, true);
|
return this.#annotations.reduce((acc, annotation) => !hidden.has(annotation.id) && acc, true);
|
||||||
});
|
});
|
||||||
|
readonly #isDocumine = getConfig().IS_DOCUMINE;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly viewModeService: ViewModeService,
|
readonly viewModeService: ViewModeService,
|
||||||
@ -55,6 +56,15 @@ export class AnnotationActionsComponent implements OnChanges {
|
|||||||
return this.#annotations;
|
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()
|
@Input()
|
||||||
set annotations(annotations: AnnotationWrapper[]) {
|
set annotations(annotations: AnnotationWrapper[]) {
|
||||||
this.#annotations = annotations.filter(a => a !== undefined);
|
this.#annotations = annotations.filter(a => a !== undefined);
|
||||||
|
|||||||
@ -25,7 +25,6 @@ const NOTIFICATIONS_THRESHOLD = 1000;
|
|||||||
export class NotificationsService extends EntitiesService<INotification, Notification> implements OnDestroy {
|
export class NotificationsService extends EntitiesService<INotification, Notification> implements OnDestroy {
|
||||||
readonly #config = getConfig<AppConfig>();
|
readonly #config = getConfig<AppConfig>();
|
||||||
readonly #subscription = new Subscription();
|
readonly #subscription = new Subscription();
|
||||||
readonly #filterDocumineNotifications: string[] = [NotificationTypes.ASSIGN_REVIEWER];
|
|
||||||
protected readonly _defaultModelPath = 'notification';
|
protected readonly _defaultModelPath = 'notification';
|
||||||
protected readonly _entityClass = Notification;
|
protected readonly _entityClass = Notification;
|
||||||
|
|
||||||
@ -119,10 +118,6 @@ export class NotificationsService extends EntitiesService<INotification, Notific
|
|||||||
const todayDate = dayjs(new Date());
|
const todayDate = dayjs(new Date());
|
||||||
|
|
||||||
notifications = notifications.filter(n => {
|
notifications = notifications.filter(n => {
|
||||||
if (this.#config.IS_DOCUMINE && this.#filterDocumineNotifications.includes(n.notificationType)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(n.notificationType in NotificationTypes)) {
|
if (!(n.notificationType in NotificationTypes)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,8 +18,8 @@
|
|||||||
"SELECTION_MODE": "structural",
|
"SELECTION_MODE": "structural",
|
||||||
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",
|
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",
|
||||||
"ANNOTATIONS_THRESHOLD": 1000,
|
"ANNOTATIONS_THRESHOLD": 1000,
|
||||||
"THEME": "redact",
|
"THEME": "scm",
|
||||||
"BASE_TRANSLATIONS_DIRECTORY": "/assets/i18n/redact/",
|
"BASE_TRANSLATIONS_DIRECTORY": "/assets/i18n/scm/",
|
||||||
"AVAILABLE_NOTIFICATIONS_DAYS": 30,
|
"AVAILABLE_NOTIFICATIONS_DAYS": 30,
|
||||||
"AVAILABLE_OLD_NOTIFICATIONS_MINUTES": 60,
|
"AVAILABLE_OLD_NOTIFICATIONS_MINUTES": 60,
|
||||||
"NOTIFICATIONS_THRESHOLD": 1000,
|
"NOTIFICATIONS_THRESHOLD": 1000,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user