diff options
Diffstat (limited to 'client/src/app/menu/avatar-notification.component.ts')
-rw-r--r-- | client/src/app/menu/avatar-notification.component.ts | 15 |
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 @@ | |||
1 | import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core' |
2 | import { User } from '../shared/users/user.model' | 2 | import { User } from '../shared/users/user.model' |
3 | import { UserNotificationService } from '@app/shared/users/user-notification.service' | 3 | import { UserNotificationService } from '@app/shared/users/user-notification.service' |
4 | import { Subscription } from 'rxjs' | 4 | import { Subject, Subscription } from 'rxjs' |
5 | import { Notifier, UserNotificationSocket } from '@app/core' | 5 | import { Notifier, UserNotificationSocket } from '@app/core' |
6 | import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' | 6 | import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' |
7 | import { NavigationEnd, Router } from '@angular/router' | 7 | import { NavigationEnd, Router } from '@angular/router' |
8 | import { filter } from 'rxjs/operators' | 8 | import { filter } from 'rxjs/operators' |
9 | import { 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 | }) |
15 | export class AvatarNotificationComponent implements OnInit, OnDestroy { | 16 | export 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 () { |