ActivityPub-federated video streaming platform using P2P directly in your web browser
Optimize homepage videos query
Chocobozzz92fb7a2b6298
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.tsindex cbd5c7bf58..53fae6ad4b 100644--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts@@ -1,11 +1,12 @@-import { finalize } from 'rxjs/operators'+import { finalize, map } from 'rxjs/operators'import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'import { AuthService, Notifier } from '@app/core'import { objectKeysTyped } from '@peertube/peertube-core-utils'-import { VideoSortField } from '@peertube/peertube-models'+import { ResultList, VideoSortField } from '@peertube/peertube-models'import { Video, VideoService } from '../../shared-main'import { MiniatureDisplayOptions } from '../../shared-video-miniature'import { CustomMarkupComponent } from './shared'+import { Observable } from 'rxjs'/** Markup component list videos depending on criteria@@ -75,7 +76,7 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInitreturn this.getVideosObservable().pipe(finalize(() => this.loaded.emit(true))).subscribe({- next: ({ data }) => {+ next: data => {this.videos = datathis.cd.markForCheck()},@@ -96,12 +97,16 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInitisLive: this.isLive,sort: this.sort as VideoSortField,account: { nameWithHost: this.accountHandle },- videoChannel: { nameWithHost: this.channelHandle }+ videoChannel: { nameWithHost: this.channelHandle },+ skipCount: true}- if (this.channelHandle) return this.videoService.getVideoChannelVideos(options)- if (this.accountHandle) return this.videoService.getAccountVideos(options)+ let obs: Observable<ResultList<Video>>- return this.videoService.getVideos(options)+ if (this.channelHandle) obs = this.videoService.getVideoChannelVideos(options)+ else if (this.accountHandle) obs = this.videoService.getAccountVideos(options)+ else obs = this.videoService.getVideos(options)++ return obs.pipe(map(({ data }) => data))}}diff --git a/client/src/app/shared/shared-search/find-in-bulk.service.ts b/client/src/app/shared/shared-search/find-in-bulk.service.tsindex de57c7f642..9c02a50000 100644--- a/client/src/app/shared/shared-search/find-in-bulk.service.ts+++ b/client/src/app/shared/shared-search/find-in-bulk.service.ts@@ -3,7 +3,6 @@ import { Observable, Subject } from 'rxjs'import { filter, first, map } from 'rxjs/operators'import { Injectable } from '@angular/core'import { buildBulkObservable } from '@app/helpers'-import { ResultList } from '@peertube/peertube-models'import { Video, VideoChannel } from '../shared-main'import { VideoPlaylist } from '../shared-video-playlist'import { AdvancedSearch } from './advanced-search.model'@@ -21,9 +20,9 @@ export class FindInBulkService {private advancedSearchForBulk: AdvancedSearch- private getVideoInBulk: BulkObservables<string, ResultList<Video>>- private getChannelInBulk: BulkObservables<string, ResultList<VideoChannel>>- private getPlaylistInBulk: BulkObservables<string, ResultList<VideoPlaylist>>+ private getVideoInBulk: BulkObservables<string, { data: Video[] }>+ private getChannelInBulk: BulkObservables<string, { data: VideoChannel[] }>+ private getPlaylistInBulk: BulkObservables<string, { data: VideoPlaylist[] }>constructor (private searchService: SearchService@@ -66,7 +65,7 @@ export class FindInBulkService {}private getData <P extends number | string, R> (options: {- observableObject: BulkObservables<P, ResultList<R>>+ observableObject: BulkObservables<P, { data: R[] }>param: Pfinder: (d: R) => boolean}) {@@ -104,6 +103,7 @@ export class FindInBulkService {return this.searchService.searchVideos({uuids,componentPagination: { itemsPerPage: uuids.length, currentPage: 1 },+ skipCount: true,advancedSearch: this.advancedSearchForBulk})}