diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-18 15:29:38 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-18 15:29:38 +0100 |
commit | 0aa52e170727ac6bdf441bcaa2353ae0b8a354ed (patch) | |
tree | 52fa047cf9970590cab1dcc7a3e5caa8eb004171 /client/src/app/shared/shared-main | |
parent | ff2cac9fa361a3c5489078f441ed54230c045971 (diff) | |
download | PeerTube-0aa52e170727ac6bdf441bcaa2353ae0b8a354ed.tar.gz PeerTube-0aa52e170727ac6bdf441bcaa2353ae0b8a354ed.tar.zst PeerTube-0aa52e170727ac6bdf441bcaa2353ae0b8a354ed.zip |
Add ability to display all channel/account videos
Diffstat (limited to 'client/src/app/shared/shared-main')
-rw-r--r-- | client/src/app/shared/shared-main/video/video.service.ts | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 0e2d36081..c8a3ec043 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts | |||
@@ -134,16 +134,28 @@ export class VideoService implements VideosProvider { | |||
134 | ) | 134 | ) |
135 | } | 135 | } |
136 | 136 | ||
137 | getAccountVideos ( | 137 | getAccountVideos (parameters: { |
138 | account: Account, | 138 | account: Account, |
139 | videoPagination: ComponentPaginationLight, | 139 | videoPagination: ComponentPaginationLight, |
140 | sort: VideoSortField | 140 | sort: VideoSortField |
141 | ): Observable<ResultList<Video>> { | 141 | nsfwPolicy?: NSFWPolicyType |
142 | videoFilter?: VideoFilter | ||
143 | }): Observable<ResultList<Video>> { | ||
144 | const { account, videoPagination, sort, videoFilter, nsfwPolicy } = parameters | ||
145 | |||
142 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 146 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
143 | 147 | ||
144 | let params = new HttpParams() | 148 | let params = new HttpParams() |
145 | params = this.restService.addRestGetParams(params, pagination, sort) | 149 | params = this.restService.addRestGetParams(params, pagination, sort) |
146 | 150 | ||
151 | if (nsfwPolicy) { | ||
152 | params = params.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy)) | ||
153 | } | ||
154 | |||
155 | if (videoFilter) { | ||
156 | params = params.set('filter', videoFilter) | ||
157 | } | ||
158 | |||
147 | return this.authHttp | 159 | return this.authHttp |
148 | .get<ResultList<Video>>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/videos', { params }) | 160 | .get<ResultList<Video>>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/videos', { params }) |
149 | .pipe( | 161 | .pipe( |
@@ -152,12 +164,15 @@ export class VideoService implements VideosProvider { | |||
152 | ) | 164 | ) |
153 | } | 165 | } |
154 | 166 | ||
155 | getVideoChannelVideos ( | 167 | getVideoChannelVideos (parameters: { |
156 | videoChannel: VideoChannel, | 168 | videoChannel: VideoChannel, |
157 | videoPagination: ComponentPaginationLight, | 169 | videoPagination: ComponentPaginationLight, |
158 | sort: VideoSortField, | 170 | sort: VideoSortField, |
159 | nsfwPolicy?: NSFWPolicyType | 171 | nsfwPolicy?: NSFWPolicyType |
160 | ): Observable<ResultList<Video>> { | 172 | videoFilter?: VideoFilter |
173 | }): Observable<ResultList<Video>> { | ||
174 | const { videoChannel, videoPagination, sort, nsfwPolicy, videoFilter } = parameters | ||
175 | |||
161 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) | 176 | const pagination = this.restService.componentPaginationToRestPagination(videoPagination) |
162 | 177 | ||
163 | let params = new HttpParams() | 178 | let params = new HttpParams() |
@@ -167,6 +182,10 @@ export class VideoService implements VideosProvider { | |||
167 | params = params.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy)) | 182 | params = params.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy)) |
168 | } | 183 | } |
169 | 184 | ||
185 | if (videoFilter) { | ||
186 | params = params.set('filter', videoFilter) | ||
187 | } | ||
188 | |||
170 | return this.authHttp | 189 | return this.authHttp |
171 | .get<ResultList<Video>>(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost + '/videos', { params }) | 190 | .get<ResultList<Video>>(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost + '/videos', { params }) |
172 | .pipe( | 191 | .pipe( |