diff --git a/API/Controllers/MetadataController.cs b/API/Controllers/MetadataController.cs index 54a6dd053..c1372419d 100644 --- a/API/Controllers/MetadataController.cs +++ b/API/Controllers/MetadataController.cs @@ -207,7 +207,7 @@ public class MetadataController(IUnitOfWork unitOfWork, ILocalizationService loc if (user == null) return Unauthorized(); var userReviews = (await unitOfWork.UserRepository.GetUserRatingDtosForSeriesAsync(seriesId, user.Id)) - .Where(r => !string.IsNullOrEmpty(r.Body)) + .Where(r => !string.IsNullOrEmpty(r.BodyJustText)) .OrderByDescending(review => review.Username.Equals(user.UserName) ? 1 : 0) .ToList(); @@ -221,7 +221,13 @@ public class MetadataController(IUnitOfWork unitOfWork, ILocalizationService loc } var ret = await metadataService.GetSeriesDetail(user.Id, seriesId); - if (ret == null) return Ok(null); + if (ret == null) return Ok(new SeriesDetailPlusDto() + { + Reviews = userReviews, + Recommendations = null, + Ratings = null + }); + await _cacheProvider.SetAsync(cacheKey, ret, TimeSpan.FromHours(48)); // For some reason if we don't use a different instance, the cache keeps changes made below diff --git a/API/DTOs/SeriesDetail/SeriesDetailPlusDto.cs b/API/DTOs/SeriesDetail/SeriesDetailPlusDto.cs index d793342b2..59ce47bf6 100644 --- a/API/DTOs/SeriesDetail/SeriesDetailPlusDto.cs +++ b/API/DTOs/SeriesDetail/SeriesDetailPlusDto.cs @@ -9,7 +9,7 @@ namespace API.DTOs.SeriesDetail; /// This is what the UI sees, not what the API sends back public class SeriesDetailPlusDto { - public RecommendationDto Recommendations { get; set; } + public RecommendationDto? Recommendations { get; set; } public IEnumerable Reviews { get; set; } - public IEnumerable Ratings { get; set; } + public IEnumerable? Ratings { get; set; } } diff --git a/UI/Web/src/app/_models/series-detail/series-detail-plus.ts b/UI/Web/src/app/_models/series-detail/series-detail-plus.ts index 679c02aee..8160b210f 100644 --- a/UI/Web/src/app/_models/series-detail/series-detail-plus.ts +++ b/UI/Web/src/app/_models/series-detail/series-detail-plus.ts @@ -3,7 +3,7 @@ import {UserReview} from "../../_single-module/review-card/user-review"; import {Rating} from "../rating"; export interface SeriesDetailPlus { - recommendations: Recommendation; + recommendations?: Recommendation; reviews: Array; - ratings: Array; + ratings?: Array; } diff --git a/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.ts b/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.ts index b6d7573a9..b8f321a10 100644 --- a/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.ts +++ b/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.ts @@ -587,7 +587,7 @@ export class SeriesDetailComponent implements OnInit, AfterContentChecked { }); this.setContinuePoint(); - if (KavitaPlusSupportedLibraryTypes.includes(this.libraryType) && loadExternal) { + if (loadExternal) { this.loadPlusMetadata(this.seriesId); } @@ -701,10 +701,16 @@ export class SeriesDetailComponent implements OnInit, AfterContentChecked { // Reviews this.reviews = [...data.reviews]; - this.ratings = [...data.ratings]; + if (data.ratings) { + this.ratings = [...data.ratings]; + } + // Recommendations - this.combinedRecs = [...data.recommendations.ownedSeries, ...data.recommendations.externalSeries]; + if (data.recommendations) { + this.combinedRecs = [...data.recommendations.ownedSeries, ...data.recommendations.externalSeries]; + } + this.hasRecommendations = this.combinedRecs.length > 0; this.cdRef.markForCheck(); diff --git a/openapi.json b/openapi.json index f8b487ce8..9a9b31319 100644 --- a/openapi.json +++ b/openapi.json @@ -7,7 +7,7 @@ "name": "GPL-3.0", "url": "https://github.com/Kareadita/Kavita/blob/develop/LICENSE" }, - "version": "0.7.13.12" + "version": "0.7.13.13" }, "servers": [ {