X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fusers%2Fuser-notifications.component.ts;h=977dd8925c80eea6db5703f7eb7f21d00f41ef7c;hb=366b21f13f75b33f9d64744d7564e7cddf5b1ae8;hp=ce43b604a33a929abd25447310a5e2fb01f7efd3;hpb=97567dd81f508dd6295ac4d73d849aa2ce0a6549;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/users/user-notifications.component.ts b/client/src/app/shared/users/user-notifications.component.ts index ce43b604a..977dd8925 100644 --- a/client/src/app/shared/users/user-notifications.component.ts +++ b/client/src/app/shared/users/user-notifications.component.ts @@ -4,6 +4,7 @@ import { UserNotificationType } from '../../../../../shared' import { ComponentPagination, hasMoreItems } from '@app/shared/rest/component-pagination.model' import { Notifier } from '@app/core' import { UserNotification } from '@app/shared/users/user-notification.model' +import { Subject } from 'rxjs' @Component({ selector: 'my-user-notifications', @@ -14,6 +15,7 @@ export class UserNotificationsComponent implements OnInit { @Input() ignoreLoadingBar = false @Input() infiniteScroll = true @Input() itemsPerPage = 20 + @Input() markAllAsReadSubject: Subject @Output() notificationsLoaded = new EventEmitter() @@ -24,6 +26,8 @@ export class UserNotificationsComponent implements OnInit { componentPagination: ComponentPagination + onDataSubject = new Subject() + constructor ( private userNotificationService: UserNotificationService, private notifier: Notifier @@ -37,6 +41,10 @@ export class UserNotificationsComponent implements OnInit { } this.loadMoreNotifications() + + if (this.markAllAsReadSubject) { + this.markAllAsReadSubject.subscribe(() => this.markAllAsRead()) + } } loadMoreNotifications () { @@ -47,6 +55,8 @@ export class UserNotificationsComponent implements OnInit { this.componentPagination.totalItems = result.total this.notificationsLoaded.emit() + + this.onDataSubject.next(result.data) }, err => this.notifier.error(err.message)