From 2a4c0d8bbe29178ae90e776bb9453f86e6d23bd9 Mon Sep 17 00:00:00 2001 From: Wicklow <123956049+wickloww@users.noreply.github.com> Date: Wed, 12 Apr 2023 07:32:20 +0000 Subject: Feature/filter already watched videos (#5739) * filter already watched videos * Updated code based on review comments --- .../recommendations/recent-videos-recommendation.service.ts | 3 +++ client/src/app/shared/shared-search/advanced-search.model.ts | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'client/src') 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 searchTarget: 'local', nsfw: user.nsfwPolicy ? this.videos.nsfwPolicyToParam(user.nsfwPolicy) + : undefined, + excludeAlreadyWatched: user.id + ? true : undefined }) } 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 { searchTarget: SearchTargetType resultType: AdvancedSearchResultType + excludeAlreadyWatched?: boolean + constructor (options?: { startDate?: string endDate?: string @@ -62,6 +64,8 @@ export class AdvancedSearch { sort?: string searchTarget?: SearchTargetType resultType?: AdvancedSearchResultType + + excludeAlreadyWatched?: boolean }) { if (!options) return @@ -87,6 +91,8 @@ export class AdvancedSearch { this.resultType = options.resultType || undefined + this.excludeAlreadyWatched = options.excludeAlreadyWatched || undefined + if (!this.resultType && this.hasVideoFilter()) { this.resultType = 'videos' } @@ -138,7 +144,8 @@ export class AdvancedSearch { host: this.host, sort: this.sort, searchTarget: this.searchTarget, - resultType: this.resultType + resultType: this.resultType, + excludeAlreadyWatched: this.excludeAlreadyWatched } } @@ -162,7 +169,8 @@ export class AdvancedSearch { host: this.host, isLive, sort: this.sort, - searchTarget: this.searchTarget + searchTarget: this.searchTarget, + excludeAlreadyWatched: this.excludeAlreadyWatched } } -- cgit v1.2.3