Skip to content

Commit 2268dcf

Browse files
authored
Fix anilist edge case bug (#827)
* fix(backend): get data from anilist correctly * fix(frontend): send correct details to endpoint * build(backend): bump version
1 parent f9cd4e8 commit 2268dcf

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/backend/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ryot"
3-
version = "5.2.7"
3+
version = "5.2.8"
44
edition = "2021"
55
repository = "https://github.com/IgnisDa/ryot"
66
license = "GPL-3.0"

apps/backend/src/providers/anilist/mod.rs

+14-13
Original file line numberDiff line numberDiff line change
@@ -622,19 +622,20 @@ async fn media_details(client: &Client, id: &str, prefer_english: bool) -> Resul
622622
.nodes
623623
.unwrap()
624624
.into_iter()
625-
.map(|r| {
626-
let data = r.unwrap().media_recommendation.unwrap();
627-
PartialMetadataWithoutId {
628-
title: data.title.unwrap().user_preferred.unwrap(),
629-
identifier: data.id.to_string(),
630-
source: MediaSource::Anilist,
631-
lot: match data.type_.unwrap() {
632-
media_details_query::MediaType::ANIME => MediaLot::Anime,
633-
media_details_query::MediaType::MANGA => MediaLot::Manga,
634-
media_details_query::MediaType::Other(_) => unreachable!(),
635-
},
636-
image: data.cover_image.unwrap().extra_large,
637-
}
625+
.flat_map(|r| {
626+
r.unwrap()
627+
.media_recommendation
628+
.map(|data| PartialMetadataWithoutId {
629+
title: data.title.unwrap().user_preferred.unwrap(),
630+
identifier: data.id.to_string(),
631+
source: MediaSource::Anilist,
632+
lot: match data.type_.unwrap() {
633+
media_details_query::MediaType::ANIME => MediaLot::Anime,
634+
media_details_query::MediaType::MANGA => MediaLot::Manga,
635+
media_details_query::MediaType::Other(_) => unreachable!(),
636+
},
637+
image: data.cover_image.unwrap().extra_large,
638+
})
638639
})
639640
.collect();
640641
let score = details.average_score.map(Decimal::from);

apps/frontend/app/routes/_dashboard.media.$action.$lot.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@ const MediaSearchItem = (props: {
630630
const form = new FormData();
631631
form.append("entityId", id);
632632
form.append("entityLot", EntityLot.Media);
633+
form.append("creatorUserId", loaderData.userId.toString());
633634
form.append("collectionName", "Watchlist");
634635
await fetch(
635636
$path("/actions", { intent: "addEntityToCollection" }),

0 commit comments

Comments
 (0)