ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix listing account/channel videos
Chocobozzzb78a1bec9cc0
diff --git a/client/src/app/+admin/overview/videos/video-admin.service.ts b/client/src/app/+admin/overview/videos/video-admin.service.tsindex 17597be0e9..02c1bb87f5 100644--- a/client/src/app/+admin/overview/videos/video-admin.service.ts+++ b/client/src/app/+admin/overview/videos/video-admin.service.ts@@ -3,7 +3,7 @@ import { Injectable, inject } from '@angular/core'import { RestExtractor, RestPagination, RestService } from '@app/core'import { AdvancedInputFilter } from '@app/shared/shared-forms/advanced-input-filter.component'import { Video } from '@app/shared/shared-main/video/video.model'-import { CommonVideoParams, VideoService } from '@app/shared/shared-main/video/video.service'+import { VideoListParams, VideoService } from '@app/shared/shared-main/video/video.service'import { getAllPrivacies, omit } from '@peertube/peertube-core-utils'import { ResultList, VideoInclude, VideoPrivacy } from '@peertube/peertube-models'import { Observable } from 'rxjs'@@ -17,12 +17,12 @@ export class VideoAdminService {private restService = inject(RestService)getAdminVideos (- options: CommonVideoParams & { pagination: RestPagination, search?: string }+ options: VideoListParams & { pagination: RestPagination, search?: string }): Observable<ResultList<Video>> {const { pagination, search } = optionslet params = new HttpParams()- params = this.videoService.buildCommonVideosParams({ params, ...omit(options, [ 'search', 'pagination' ]) })+ params = this.videoService.buildVideoListParams({ params, ...omit(options, [ 'search', 'pagination' ]) })params = params.set('start', pagination.start.toString()).set('count', pagination.count.toString())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 6a7e60f044..49f90fe2e6 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@@ -2,7 +2,7 @@ import { NgFor, NgStyle } from '@angular/common'import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, inject, input, output } from '@angular/core'import { AuthService, Notifier, User, UserService } from '@app/core'import { Video } from '@app/shared/shared-main/video/video.model'-import { CommonVideoParams, VideoService } from '@app/shared/shared-main/video/video.service'+import { VideoListParams, VideoService } from '@app/shared/shared-main/video/video.service'import { objectKeysTyped } from '@peertube/peertube-core-utils'import { ResultList, VideoSortField } from '@peertube/peertube-models'import { Observable } from 'rxjs'@@ -86,7 +86,7 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit}getVideosObservable () {- const options: CommonVideoParams = {+ const options: VideoListParams = {videoPagination: {currentPage: 1,itemsPerPage: this.count()diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.tsindex 6f1258b2b8..4c6a62182c 100644--- a/client/src/app/shared/shared-main/video/video.service.ts+++ b/client/src/app/shared/shared-main/video/video.service.ts@@ -45,12 +45,14 @@ import { from, Observable, of, throwError } from 'rxjs'import { catchError, concatMap, map, switchMap, toArray } from 'rxjs/operators'import { environment } from '../../../../environments/environment'import { Account } from '../account/account.model'+import { AccountService } from '../account/account.service'import { VideoChannel } from '../channel/video-channel.model'+import { VideoChannelService } from '../channel/video-channel.service'import { VideoDetails } from './video-details.model'import { VideoPasswordService } from './video-password.service'import { Video } from './video.model'-export type CommonVideoParams = Omit<VideosCommonQuery, 'start' | 'count' | 'sort'> & {+export type VideoListParams = Omit<VideosCommonQuery, 'start' | 'count' | 'sort'> & {videoPagination?: ComponentPaginationLightsort: VideoSortField | SortMeta}@@ -155,15 +157,15 @@ export class VideoService {}listAccountVideos (- options: CommonVideoParams & {+ options: VideoListParams & {account: Pick<Account, 'nameWithHost'>}): Observable<ResultList<Video>> {- return this.listVideos({ ...options, videoChannel: options.account })+ return this.listVideos({ ...options, account: options.account })}listChannelVideos (- options: CommonVideoParams & {+ options: VideoListParams & {videoChannel: Pick<VideoChannel, 'nameWithHost'>}): Observable<ResultList<Video>> {@@ -171,23 +173,34 @@ export class VideoService {}listVideos (- options: CommonVideoParams & {+ optionsArg: VideoListParams & {videoChannel?: Pick<VideoChannel, 'nameWithHost'>account?: Pick<Account, 'nameWithHost'>}): Observable<ResultList<Video>> {+ const { account, videoChannel, ...options } = optionsArg+let params = new HttpParams()- params = this.buildCommonVideosParams({ params, ...options })+ params = this.buildVideoListParams({ params, ...options })++ let url: string+ if (videoChannel) {+ url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost + '/videos'+ } else if (account) {+ url = AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/videos'+ } else {+ url = VideoService.BASE_VIDEO_URL+ }return this.authHttp- .get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params })+ .get<ResultList<Video>>(url, { params }).pipe(switchMap(res => this.extractVideos(res)),catchError(err => this.restExtractor.handleError(err)))}- buildCommonVideosParams (options: CommonVideoParams & { params: HttpParams }) {+ buildVideoListParams (options: VideoListParams & { params: HttpParams }) {const {params,videoPagination,@@ -221,7 +234,7 @@ export class VideoService {return this.restService.addObjectParams(newParams, otherOptions)}- buildNSFWParams (params: HttpParams, options: Pick<CommonVideoParams, 'nsfw' | 'nsfwFlagsExcluded' | 'nsfwFlagsIncluded'> = {}) {+ buildNSFWParams (params: HttpParams, options: Pick<VideoListParams, 'nsfw' | 'nsfwFlagsExcluded' | 'nsfwFlagsIncluded'> = {}) {const { nsfw, nsfwFlagsExcluded, nsfwFlagsIncluded } = optionsconst anonymous = this.auth.isLoggedIn()