X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-video-miniature%2Fabstract-video-list.ts;h=f12ae2ee58363710c6860c6ee74a6bea20260612;hb=2e80d256cc75b4b02c8efc3d3e4cdf57ddf401a8;hp=33061a837509276b5a8b0122293b86fa199bf3bf;hpb=ac27887774e63d99f4e227fbe18846f143cc4b3c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts index 33061a837..f12ae2ee5 100644 --- a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts +++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts @@ -42,7 +42,7 @@ enum GroupDate { } @Directive() -// tslint:disable-next-line: directive-class-suffix +// eslint-disable-next-line @angular-eslint/directive-class-suffix export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterContentInit, DisableForReuseHook { @ViewChild('videoListHeader', { static: true, read: ViewContainerRef }) videoListHeader: ViewContainerRef @@ -174,7 +174,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConte ngAfterContentInit () { if (this.videoListHeader) { // some components don't use the header: they use their own template, like my-history.component.html - this.setHeader.apply(this, [ this.HeaderComponent, this.headerComponentInjector ]) + this.setHeader(this.HeaderComponent, this.headerComponentInjector) } } @@ -204,28 +204,29 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConte } loadMoreVideos (reset = false) { - this.getVideosObservable(this.pagination.currentPage).subscribe( - ({ data }) => { - this.hasDoneFirstQuery = true - this.lastQueryLength = data.length + this.getVideosObservable(this.pagination.currentPage) + .subscribe({ + next: ({ data }) => { + this.hasDoneFirstQuery = true + this.lastQueryLength = data.length - if (reset) this.videos = [] - this.videos = this.videos.concat(data) + if (reset) this.videos = [] + this.videos = this.videos.concat(data) - if (this.groupByDate) this.buildGroupedDateLabels() + if (this.groupByDate) this.buildGroupedDateLabels() - this.onMoreVideos() + this.onMoreVideos() - this.onDataSubject.next(data) - }, + this.onDataSubject.next(data) + }, - error => { - const message = $localize`Cannot load more videos. Try again later.` + error: err => { + const message = $localize`Cannot load more videos. Try again later.` - console.error(message, { error }) - this.notifier.error(message) - } - ) + console.error(message, { err }) + this.notifier.error(message) + } + }) } reloadVideos () { @@ -277,7 +278,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConte if (currentGroupedDate !== period.value) { currentGroupedDate = period.value - this.groupedDates[ video.id ] = currentGroupedDate + this.groupedDates[video.id] = currentGroupedDate } break @@ -301,13 +302,13 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConte i: Injector = this.headerComponentInjector ) { const injector = i || Injector.create({ - providers: [{ + providers: [ { provide: 'data', useValue: { titlePage: this.titlePage, titleTooltip: this.titleTooltip } - }] + } ] }) const viewContainerRef = this.videoListHeader viewContainerRef.clear() @@ -330,9 +331,9 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConte protected loadPageRouteParams (_queryParams: Params) { /* empty */ } protected loadRouteParams (queryParams: Params) { - this.sort = queryParams[ 'sort' ] as VideoSortField || this.defaultSort - this.categoryOneOf = queryParams[ 'categoryOneOf' ] - this.angularState = queryParams[ 'a-state' ] + this.sort = queryParams['sort'] as VideoSortField || this.defaultSort + this.categoryOneOf = queryParams['categoryOneOf'] + this.angularState = queryParams['a-state'] this.loadPageRouteParams(queryParams) }