diff options
4 files changed, 13 insertions, 13 deletions
diff --git a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts index 631444398..2ee168492 100644 --- a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts +++ b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts | |||
@@ -2,10 +2,10 @@ import { from, Subject, Subscription } from 'rxjs' | |||
2 | import { concatMap, map, switchMap, tap } from 'rxjs/operators' | 2 | import { concatMap, map, switchMap, tap } from 'rxjs/operators' |
3 | import { Component, OnDestroy, OnInit } from '@angular/core' | 3 | import { Component, OnDestroy, OnInit } from '@angular/core' |
4 | import { ComponentPagination, hasMoreItems, MarkdownService, User, UserService } from '@app/core' | 4 | import { ComponentPagination, hasMoreItems, MarkdownService, User, UserService } from '@app/core' |
5 | import { SimpleMemoize } from '@app/helpers' | ||
5 | import { Account, AccountService, Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' | 6 | import { Account, AccountService, Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' |
6 | import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature' | 7 | import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature' |
7 | import { NSFWPolicyType, VideoSortField } from '@shared/models' | 8 | import { NSFWPolicyType, VideoSortField } from '@shared/models' |
8 | import { SimpleMemoize } from '@app/helpers' | ||
9 | 9 | ||
10 | @Component({ | 10 | @Component({ |
11 | selector: 'my-account-video-channels', | 11 | selector: 'my-account-video-channels', |
@@ -98,7 +98,7 @@ export class AccountVideoChannelsComponent implements OnInit, OnDestroy { | |||
98 | videoChannel, | 98 | videoChannel, |
99 | videoPagination: this.videosPagination, | 99 | videoPagination: this.videosPagination, |
100 | sort: this.videosSort, | 100 | sort: this.videosSort, |
101 | nsfwPolicy: this.nsfwPolicy | 101 | nsfw: this.videoService.nsfwPolicyToParam(this.nsfwPolicy) |
102 | } | 102 | } |
103 | 103 | ||
104 | return this.videoService.getVideoChannelVideos(options) | 104 | return this.videoService.getVideoChannelVideos(options) |
diff --git a/client/src/app/+videos/+video-watch/shared/recommendations/recent-videos-recommendation.service.ts b/client/src/app/+videos/+video-watch/shared/recommendations/recent-videos-recommendation.service.ts index 8f4594b25..ba0d30f3d 100644 --- a/client/src/app/+videos/+video-watch/shared/recommendations/recent-videos-recommendation.service.ts +++ b/client/src/app/+videos/+video-watch/shared/recommendations/recent-videos-recommendation.service.ts | |||
@@ -43,9 +43,14 @@ export class RecentVideosRecommendationService implements RecommendationService | |||
43 | return this.userService.getAnonymousOrLoggedUser() | 43 | return this.userService.getAnonymousOrLoggedUser() |
44 | .pipe( | 44 | .pipe( |
45 | switchMap(user => { | 45 | switchMap(user => { |
46 | const nsfw = user.nsfwPolicy | ||
47 | ? this.videos.nsfwPolicyToParam(user.nsfwPolicy) | ||
48 | : undefined | ||
49 | |||
46 | const defaultSubscription = this.videos.getVideos({ | 50 | const defaultSubscription = this.videos.getVideos({ |
47 | videoPagination: pagination, | 51 | videoPagination: pagination, |
48 | sort: '-publishedAt' | 52 | sort: '-publishedAt', |
53 | nsfw | ||
49 | }).pipe(map(v => v.data)) | 54 | }).pipe(map(v => v.data)) |
50 | 55 | ||
51 | const searchIndexConfig = this.config.search.searchIndex | 56 | const searchIndexConfig = this.config.search.searchIndex |
@@ -60,9 +65,7 @@ export class RecentVideosRecommendationService implements RecommendationService | |||
60 | tagsOneOf: recommendation.tags.join(','), | 65 | tagsOneOf: recommendation.tags.join(','), |
61 | sort: '-publishedAt', | 66 | sort: '-publishedAt', |
62 | searchTarget: 'local', | 67 | searchTarget: 'local', |
63 | nsfw: user.nsfwPolicy | 68 | nsfw, |
64 | ? this.videos.nsfwPolicyToParam(user.nsfwPolicy) | ||
65 | : undefined, | ||
66 | excludeAlreadyWatched: user.id | 69 | excludeAlreadyWatched: user.id |
67 | ? true | 70 | ? true |
68 | : undefined | 71 | : undefined |
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) |