Merge branch 'RED-9370' into 'master'

RED-9370: fixed notification links not working.

See merge request redactmanager/red-ui!463
This commit is contained in:
Valentin-Gabriel Mihai 2024-06-19 17:56:08 +02:00
commit b0ab6bd302
2 changed files with 12 additions and 4 deletions

View File

@ -32,19 +32,18 @@
</div>
<div
(click)="markRead([notification], true)"
(click)="handleMarkReadEvent($event, [notification], true)"
*ngFor="let notification of group.notifications; trackBy: trackBy"
[class.unread]="!notification.readDate"
[id]="'notifications-mark-as-read-' + notification.id + '-btn'"
class="notification"
iqserStopPropagation
mat-menu-item
>
<iqser-initials-avatar [user]="notification.userId"></iqser-initials-avatar>
<div class="notification-content">
<div [innerHTML]="notification.message"></div>
<div class="small-label mt-2">{{ notification.creationDate | date : 'exactDate' }}</div>
<div class="small-label mt-2">{{ notification.creationDate | date: 'exactDate' }}</div>
</div>
<div
@ -52,7 +51,7 @@
[id]="'notifications-mark-' + notification.id"
class="dot"
iqserStopPropagation
matTooltip="{{ 'notifications.mark-as' | translate : { type: notification.readDate ? 'unread' : 'read' } }}"
matTooltip="{{ 'notifications.mark-as' | translate: { type: notification.readDate ? 'unread' : 'read' } }}"
matTooltipPosition="before"
></div>
</div>

View File

@ -58,6 +58,15 @@ export class NotificationsComponent {
await this._notificationsService.toggleNotificationRead(notificationsIds, isRead);
}
async handleMarkReadEvent(event: MouseEvent, notifications: Notification[] = this._notificationsService.all, isRead = true) {
if (!(event.target as HTMLBaseElement).href) {
event.stopPropagation();
event.preventDefault();
}
await this.markRead(notifications, isRead);
}
#groupNotifications(notifications: Notification[]): NotificationsGroup[] {
const todayTranslation = this._translateService.instant('today');
const groupedMap = notifications.groupBy(n => {