markRead method now has all notifications by default
This commit is contained in:
parent
a9159eda22
commit
3b64e75ae2
@ -17,7 +17,7 @@
|
||||
</div>
|
||||
|
||||
<div
|
||||
(click)="markRead($event, notification)"
|
||||
(click)="markRead($event, [notification.id])"
|
||||
*ngFor="let notification of group.notifications | sortBy: 'desc':'creationDate'"
|
||||
[class.unread]="!notification.readDate"
|
||||
class="notification"
|
||||
@ -29,7 +29,7 @@
|
||||
<div class="small-label mt-2">{{ notification.time }}</div>
|
||||
</div>
|
||||
<div
|
||||
(click)="markRead($event, notification, !notification.readDate)"
|
||||
(click)="markRead($event, [notification.id], !notification.readDate)"
|
||||
class="dot"
|
||||
matTooltip="{{ 'notifications.mark-as' | translate: { type: notification.readDate ? 'unread' : 'read' } }}"
|
||||
matTooltipPosition="before"
|
||||
|
||||
@ -8,6 +8,7 @@ import { NotificationsService } from '@services/notifications.service';
|
||||
import { Notification } from '@red/domain';
|
||||
import { distinctUntilChanged, map, shareReplay } from 'rxjs/operators';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { List } from '@iqser/common-ui';
|
||||
|
||||
interface NotificationsGroup {
|
||||
date: string;
|
||||
@ -47,10 +48,9 @@ export class NotificationsComponent implements OnInit {
|
||||
await this._loadData();
|
||||
}
|
||||
|
||||
async markRead($event, notification?: Notification, isRead = true): Promise<void> {
|
||||
async markRead($event, notifications: List<string> = this._notifications$.getValue().map(n => n.id), isRead = true): Promise<void> {
|
||||
$event.stopPropagation();
|
||||
const body = notification ? [notification.id] : this._notifications$.getValue().map(n => n.id);
|
||||
await this._notificationsService.toggleNotificationRead(body, isRead).toPromise();
|
||||
await this._notificationsService.toggleNotificationRead(notifications, isRead).toPromise();
|
||||
await this._loadData();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user