diff options
author | Wicklow <123956049+wickloww@users.noreply.github.com> | 2023-04-12 07:32:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-12 09:32:20 +0200 |
commit | 2a4c0d8bbe29178ae90e776bb9453f86e6d23bd9 (patch) | |
tree | dfe4b6e1e06f617f8968285ca394e73fedefe6b2 /client/src/app | |
parent | 0cda019c1d1f77e06e524362880c38e93b1f5c70 (diff) | |
download | PeerTube-2a4c0d8bbe29178ae90e776bb9453f86e6d23bd9.tar.gz PeerTube-2a4c0d8bbe29178ae90e776bb9453f86e6d23bd9.tar.zst PeerTube-2a4c0d8bbe29178ae90e776bb9453f86e6d23bd9.zip |
Feature/filter already watched videos (#5739)
* filter already watched videos
* Updated code based on review comments
Diffstat (limited to 'client/src/app')
-rw-r--r-- | client/src/app/+videos/+video-watch/shared/recommendations/recent-videos-recommendation.service.ts | 3 | ||||
-rw-r--r-- | client/src/app/shared/shared-search/advanced-search.model.ts | 12 |
2 files changed, 13 insertions, 2 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 4654da847..b0ae910ac 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 | |||
@@ -63,6 +63,9 @@ export class RecentVideosRecommendationService implements RecommendationService | |||
63 | searchTarget: 'local', | 63 | searchTarget: 'local', |
64 | nsfw: user.nsfwPolicy | 64 | nsfw: user.nsfwPolicy |
65 | ? this.videos.nsfwPolicyToParam(user.nsfwPolicy) | 65 | ? this.videos.nsfwPolicyToParam(user.nsfwPolicy) |
66 | : undefined, | ||
67 | excludeAlreadyWatched: user.id | ||
68 | ? true | ||
66 | : undefined | 69 | : undefined |
67 | }) | 70 | }) |
68 | } | 71 | } |
diff --git a/client/src/app/shared/shared-search/advanced-search.model.ts b/client/src/app/shared/shared-search/advanced-search.model.ts index e8bb00fd3..29fe3e8dc 100644 --- a/client/src/app/shared/shared-search/advanced-search.model.ts +++ b/client/src/app/shared/shared-search/advanced-search.model.ts | |||
@@ -40,6 +40,8 @@ export class AdvancedSearch { | |||
40 | searchTarget: SearchTargetType | 40 | searchTarget: SearchTargetType |
41 | resultType: AdvancedSearchResultType | 41 | resultType: AdvancedSearchResultType |
42 | 42 | ||
43 | excludeAlreadyWatched?: boolean | ||
44 | |||
43 | constructor (options?: { | 45 | constructor (options?: { |
44 | startDate?: string | 46 | startDate?: string |
45 | endDate?: string | 47 | endDate?: string |
@@ -62,6 +64,8 @@ export class AdvancedSearch { | |||
62 | sort?: string | 64 | sort?: string |
63 | searchTarget?: SearchTargetType | 65 | searchTarget?: SearchTargetType |
64 | resultType?: AdvancedSearchResultType | 66 | resultType?: AdvancedSearchResultType |
67 | |||
68 | excludeAlreadyWatched?: boolean | ||
65 | }) { | 69 | }) { |
66 | if (!options) return | 70 | if (!options) return |
67 | 71 | ||
@@ -87,6 +91,8 @@ export class AdvancedSearch { | |||
87 | 91 | ||
88 | this.resultType = options.resultType || undefined | 92 | this.resultType = options.resultType || undefined |
89 | 93 | ||
94 | this.excludeAlreadyWatched = options.excludeAlreadyWatched || undefined | ||
95 | |||
90 | if (!this.resultType && this.hasVideoFilter()) { | 96 | if (!this.resultType && this.hasVideoFilter()) { |
91 | this.resultType = 'videos' | 97 | this.resultType = 'videos' |
92 | } | 98 | } |
@@ -138,7 +144,8 @@ export class AdvancedSearch { | |||
138 | host: this.host, | 144 | host: this.host, |
139 | sort: this.sort, | 145 | sort: this.sort, |
140 | searchTarget: this.searchTarget, | 146 | searchTarget: this.searchTarget, |
141 | resultType: this.resultType | 147 | resultType: this.resultType, |
148 | excludeAlreadyWatched: this.excludeAlreadyWatched | ||
142 | } | 149 | } |
143 | } | 150 | } |
144 | 151 | ||
@@ -162,7 +169,8 @@ export class AdvancedSearch { | |||
162 | host: this.host, | 169 | host: this.host, |
163 | isLive, | 170 | isLive, |
164 | sort: this.sort, | 171 | sort: this.sort, |
165 | searchTarget: this.searchTarget | 172 | searchTarget: this.searchTarget, |
173 | excludeAlreadyWatched: this.excludeAlreadyWatched | ||
166 | } | 174 | } |
167 | } | 175 | } |
168 | 176 | ||