diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-28 15:32:22 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-28 15:37:22 +0200 |
commit | 3193ac2c3b0209b87c1347032f7bd21ea651d8e6 (patch) | |
tree | ea9e66bb9c53de6798cea68ce192fd898a93b988 /client/src/app/shared | |
parent | 65bb29c6d37a96cd0cae738f8dea07f3a3b5bc3d (diff) | |
download | PeerTube-3193ac2c3b0209b87c1347032f7bd21ea651d8e6.tar.gz PeerTube-3193ac2c3b0209b87c1347032f7bd21ea651d8e6.tar.zst PeerTube-3193ac2c3b0209b87c1347032f7bd21ea651d8e6.zip |
Refactor a little bit nsfwPolicyToParam
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts | 4 | ||||
-rw-r--r-- | client/src/app/shared/shared-main/video/video.service.ts | 7 |
2 files changed, 4 insertions, 7 deletions
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts index df7cc95a7..4f00eabd3 100644 --- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts +++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts | |||
@@ -84,7 +84,9 @@ export class ChannelMiniatureMarkupComponent implements CustomMarkupComponent, O | |||
84 | return this.userService.getAnonymousOrLoggedUser() | 84 | return this.userService.getAnonymousOrLoggedUser() |
85 | .pipe( | 85 | .pipe( |
86 | map(user => user.nsfwPolicy), | 86 | map(user => user.nsfwPolicy), |
87 | switchMap(nsfwPolicy => this.videoService.getVideoChannelVideos({ ...videoOptions, nsfwPolicy })) | 87 | switchMap(nsfwPolicy => { |
88 | return this.videoService.getVideoChannelVideos({ ...videoOptions, nsfw: this.videoService.nsfwPolicyToParam(nsfwPolicy) }) | ||
89 | }) | ||
88 | ) | 90 | ) |
89 | } | 91 | } |
90 | } | 92 | } |
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 cd0a300e2..a980c2dcf 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts | |||
@@ -47,9 +47,6 @@ export type CommonVideoParams = { | |||
47 | privacyOneOf?: VideoPrivacy[] | 47 | privacyOneOf?: VideoPrivacy[] |
48 | isLive?: boolean | 48 | isLive?: boolean |
49 | skipCount?: boolean | 49 | skipCount?: boolean |
50 | |||
51 | // FIXME: remove? | ||
52 | nsfwPolicy?: NSFWPolicyType | ||
53 | nsfw?: BooleanBothQuery | 50 | nsfw?: BooleanBothQuery |
54 | } | 51 | } |
55 | 52 | ||
@@ -499,7 +496,7 @@ export class VideoService { | |||
499 | throw new Error('No highest privacy available') | 496 | throw new Error('No highest privacy available') |
500 | } | 497 | } |
501 | 498 | ||
502 | nsfwPolicyToParam (nsfwPolicy: NSFWPolicyType) { | 499 | nsfwPolicyToParam (nsfwPolicy: NSFWPolicyType): BooleanBothQuery { |
503 | return nsfwPolicy === 'do_not_list' | 500 | return nsfwPolicy === 'do_not_list' |
504 | ? 'false' | 501 | ? 'false' |
505 | : 'both' | 502 | : 'both' |
@@ -534,7 +531,6 @@ export class VideoService { | |||
534 | languageOneOf, | 531 | languageOneOf, |
535 | privacyOneOf, | 532 | privacyOneOf, |
536 | skipCount, | 533 | skipCount, |
537 | nsfwPolicy, | ||
538 | isLive, | 534 | isLive, |
539 | nsfw | 535 | nsfw |
540 | } = options | 536 | } = options |
@@ -551,7 +547,6 @@ export class VideoService { | |||
551 | if (include !== undefined) newParams = newParams.set('include', include) | 547 | if (include !== undefined) newParams = newParams.set('include', include) |
552 | if (isLive !== undefined) newParams = newParams.set('isLive', isLive) | 548 | if (isLive !== undefined) newParams = newParams.set('isLive', isLive) |
553 | if (nsfw !== undefined) newParams = newParams.set('nsfw', nsfw) | 549 | if (nsfw !== undefined) newParams = newParams.set('nsfw', nsfw) |
554 | if (nsfwPolicy !== undefined) newParams = newParams.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy)) | ||
555 | if (languageOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'languageOneOf', languageOneOf) | 550 | if (languageOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'languageOneOf', languageOneOf) |
556 | if (categoryOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'categoryOneOf', categoryOneOf) | 551 | if (categoryOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'categoryOneOf', categoryOneOf) |
557 | if (privacyOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'privacyOneOf', privacyOneOf) | 552 | if (privacyOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'privacyOneOf', privacyOneOf) |