From 1aa53c3a1571cba577205e2800be1a09f224fda1 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 18 Jul 2024 15:11:26 +0300 Subject: [PATCH] UI: Prevent action on preview and edit mode --- .../unread-notification-widget.component.ts | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/cards/unread-notification-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/cards/unread-notification-widget.component.ts index fcad768e66..2dfded3f96 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/cards/unread-notification-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/cards/unread-notification-widget.component.ts @@ -203,23 +203,29 @@ export class UnreadNotificationWidgetComponent implements OnInit, OnDestroy { } markAsRead(id: string) { - const cmd = NotificationSubscriber.createMarkAsReadCommand(this.notificationWsService, [id]); - cmd.subscribe(); + if (!this.ctx.isEdit && !this.ctx.isPreview) { + const cmd = NotificationSubscriber.createMarkAsReadCommand(this.notificationWsService, [id]); + cmd.subscribe(); + } } markAsAllRead($event: Event) { - if ($event) { - $event.stopPropagation(); + if (!this.ctx.isEdit && !this.ctx.isPreview) { + if ($event) { + $event.stopPropagation(); + } + const cmd = NotificationSubscriber.createMarkAllAsReadCommand(this.notificationWsService); + cmd.subscribe(); } - const cmd = NotificationSubscriber.createMarkAllAsReadCommand(this.notificationWsService); - cmd.subscribe(); } viewAll($event: Event) { - if ($event) { - $event.stopPropagation(); + if (!this.ctx.isEdit && !this.ctx.isPreview) { + if ($event) { + $event.stopPropagation(); + } + this.router.navigateByUrl(this.router.parseUrl('/notification/inbox')).then(() => {}); } - this.router.navigateByUrl(this.router.parseUrl('/notification/inbox')).then(() => {}); } trackById(index: number, item: NotificationRequest): string {