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