aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/menu/avatar-notification.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/menu/avatar-notification.component.ts')
-rw-r--r--client/src/app/menu/avatar-notification.component.ts15
1 files changed, 6 insertions, 9 deletions
diff --git a/client/src/app/menu/avatar-notification.component.ts b/client/src/app/menu/avatar-notification.component.ts
index ff830ac1c..989a11849 100644
--- a/client/src/app/menu/avatar-notification.component.ts
+++ b/client/src/app/menu/avatar-notification.component.ts
@@ -1,11 +1,12 @@
1import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core' 1import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'
2import { User } from '../shared/users/user.model' 2import { User } from '../shared/users/user.model'
3import { UserNotificationService } from '@app/shared/users/user-notification.service' 3import { UserNotificationService } from '@app/shared/users/user-notification.service'
4import { Subscription } from 'rxjs' 4import { Subject, Subscription } from 'rxjs'
5import { Notifier, UserNotificationSocket } from '@app/core' 5import { Notifier, UserNotificationSocket } from '@app/core'
6import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' 6import { NgbPopover } from '@ng-bootstrap/ng-bootstrap'
7import { NavigationEnd, Router } from '@angular/router' 7import { NavigationEnd, Router } from '@angular/router'
8import { filter } from 'rxjs/operators' 8import { filter } from 'rxjs/operators'
9import { UserNotificationsComponent } from '@app/shared'
9 10
10@Component({ 11@Component({
11 selector: 'my-avatar-notification', 12 selector: 'my-avatar-notification',
@@ -14,11 +15,14 @@ import { filter } from 'rxjs/operators'
14}) 15})
15export class AvatarNotificationComponent implements OnInit, OnDestroy { 16export class AvatarNotificationComponent implements OnInit, OnDestroy {
16 @ViewChild('popover', { static: true }) popover: NgbPopover 17 @ViewChild('popover', { static: true }) popover: NgbPopover
18
17 @Input() user: User 19 @Input() user: User
18 20
19 unreadNotifications = 0 21 unreadNotifications = 0
20 loaded = false 22 loaded = false
21 23
24 markAllAsReadSubject = new Subject<boolean>()
25
22 private notificationSub: Subscription 26 private notificationSub: Subscription
23 private routeSub: Subscription 27 private routeSub: Subscription
24 28
@@ -64,14 +68,7 @@ export class AvatarNotificationComponent implements OnInit, OnDestroy {
64 } 68 }
65 69
66 markAllAsRead () { 70 markAllAsRead () {
67 this.userNotificationService.markAllAsRead() 71 this.markAllAsReadSubject.next(true)
68 .subscribe(
69 () => {
70 this.unreadNotifications = 0
71 },
72
73 err => this.notifier.error(err.message)
74 )
75 } 72 }
76 73
77 private async subscribeToNotifications () { 74 private async subscribeToNotifications () {