aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorWicklow <123956049+wickloww@users.noreply.github.com>2023-03-02 13:50:55 +0000
committerGitHub <noreply@github.com>2023-03-02 14:50:55 +0100
commit692ae8c31caa5a404142c9f46e03fdc8dc5b233f (patch)
tree17d12edb5cfbfeddff2fd6f0d85b11c8954da89e /shared
parentc0a4982ebe27c89f296a0bbd518e938f09d1f054 (diff)
downloadPeerTube-692ae8c31caa5a404142c9f46e03fdc8dc5b233f.tar.gz
PeerTube-692ae8c31caa5a404142c9f46e03fdc8dc5b233f.tar.zst
PeerTube-692ae8c31caa5a404142c9f46e03fdc8dc5b233f.zip
Hotfix/filter subscription videos (#5665)
* Fix filters on subscription videos * Add tests to common video filters * Improve reliability when skipping subscrition path * Better parameters for skipping subscription videos
Diffstat (limited to 'shared')
-rw-r--r--shared/server-commands/users/subscriptions-command.ts18
-rw-r--r--shared/server-commands/videos/videos-command.ts14
2 files changed, 15 insertions, 17 deletions
diff --git a/shared/server-commands/users/subscriptions-command.ts b/shared/server-commands/users/subscriptions-command.ts
index edc60e612..b92f037f8 100644
--- a/shared/server-commands/users/subscriptions-command.ts
+++ b/shared/server-commands/users/subscriptions-command.ts
@@ -1,4 +1,4 @@
1import { HttpStatusCode, ResultList, Video, VideoChannel } from '@shared/models' 1import { HttpStatusCode, ResultList, VideoChannel } from '@shared/models'
2import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
3 3
4export class SubscriptionsCommand extends AbstractCommand { 4export class SubscriptionsCommand extends AbstractCommand {
@@ -38,22 +38,6 @@ export class SubscriptionsCommand extends AbstractCommand {
38 }) 38 })
39 } 39 }
40 40
41 listVideos (options: OverrideCommandOptions & {
42 sort?: string // default -createdAt
43 } = {}) {
44 const { sort = '-createdAt' } = options
45 const path = '/api/v1/users/me/subscriptions/videos'
46
47 return this.getRequestBody<ResultList<Video>>({
48 ...options,
49
50 path,
51 query: { sort },
52 implicitToken: true,
53 defaultExpectedStatus: HttpStatusCode.OK_200
54 })
55 }
56
57 get (options: OverrideCommandOptions & { 41 get (options: OverrideCommandOptions & {
58 uri: string 42 uri: string
59 }) { 43 }) {
diff --git a/shared/server-commands/videos/videos-command.ts b/shared/server-commands/videos/videos-command.ts
index 590244484..b5df9c325 100644
--- a/shared/server-commands/videos/videos-command.ts
+++ b/shared/server-commands/videos/videos-command.ts
@@ -210,6 +210,20 @@ export class VideosCommand extends AbstractCommand {
210 }) 210 })
211 } 211 }
212 212
213 listMySubscriptionVideos (options: OverrideCommandOptions & VideosCommonQuery = {}) {
214 const { sort = '-createdAt' } = options
215 const path = '/api/v1/users/me/subscriptions/videos'
216
217 return this.getRequestBody<ResultList<Video>>({
218 ...options,
219
220 path,
221 query: { sort, ...this.buildListQuery(options) },
222 implicitToken: true,
223 defaultExpectedStatus: HttpStatusCode.OK_200
224 })
225 }
226
213 // --------------------------------------------------------------------------- 227 // ---------------------------------------------------------------------------
214 228
215 list (options: OverrideCommandOptions & VideosCommonQuery = {}) { 229 list (options: OverrideCommandOptions & VideosCommonQuery = {}) {