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/+videos | |
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/+videos')
-rw-r--r-- | client/src/app/+videos/+video-watch/shared/recommendations/recent-videos-recommendation.service.ts | 11 |
1 files changed, 7 insertions, 4 deletions
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 |