X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-main%2Fusers%2Fuser-notification.service.ts;h=ecc66ecdbb8221c3db89f513640ff5c1a6b23bbe;hb=594d3e48d8a887bbf48ce4cc594c1c36c9640fb1;hp=8dd9472fe07a1567622f7f36a4d30ca800e24848;hpb=67ed6552b831df66713bac9e672738796128d33f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-main/users/user-notification.service.ts b/client/src/app/shared/shared-main/users/user-notification.service.ts index 8dd9472fe..ecc66ecdb 100644 --- a/client/src/app/shared/shared-main/users/user-notification.service.ts +++ b/client/src/app/shared/shared-main/users/user-notification.service.ts @@ -5,6 +5,7 @@ import { ComponentPaginationLight, RestExtractor, RestService, User, UserNotific import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '@shared/models' import { environment } from '../../../../environments/environment' import { UserNotification } from './user-notification.model' +import { SortMeta } from 'primeng/api' @Injectable() export class UserNotificationService { @@ -18,9 +19,16 @@ export class UserNotificationService { private userNotificationSocket: UserNotificationSocket ) {} - listMyNotifications (pagination: ComponentPaginationLight, unread?: boolean, ignoreLoadingBar = false) { + listMyNotifications (parameters: { + pagination: ComponentPaginationLight + ignoreLoadingBar?: boolean + unread?: boolean, + sort?: SortMeta + }) { + const { pagination, ignoreLoadingBar, unread, sort } = parameters + let params = new HttpParams() - params = this.restService.addRestGetParams(params, this.restService.componentPaginationToRestPagination(pagination)) + params = this.restService.addRestGetParams(params, this.restService.componentPaginationToRestPagination(pagination), sort) if (unread) params = params.append('unread', `${unread}`) @@ -35,7 +43,7 @@ export class UserNotificationService { } countUnreadNotifications () { - return this.listMyNotifications({ currentPage: 1, itemsPerPage: 0 }, true) + return this.listMyNotifications({ pagination: { currentPage: 1, itemsPerPage: 0 }, ignoreLoadingBar: true, unread: true }) .pipe(map(n => n.total)) }