From e1a10ca655180f56b9970c16ecf31248256623fe Mon Sep 17 00:00:00 2001 From: Mikal Stordal Date: Sun, 8 Oct 2023 21:39:14 +0200 Subject: [PATCH] fix: only set main series if default series was requested to be changed. So sending a default series id of `0` will now remove it, but omitting the id won't remove the current default series id set for the group. --- Shoko.Server/API/v3/Models/Shoko/Group.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Shoko.Server/API/v3/Models/Shoko/Group.cs b/Shoko.Server/API/v3/Models/Shoko/Group.cs index 05443eda0..65b08e237 100644 --- a/Shoko.Server/API/v3/Models/Shoko/Group.cs +++ b/Shoko.Server/API/v3/Models/Shoko/Group.cs @@ -291,7 +291,7 @@ public CreateOrUpdateGroupBody(SVR_AnimeGroup group) // Find the default series among the list of seris. SVR_AnimeSeries? defaultSeries = null; - if (DefaultSeriesID.HasValue) + if (DefaultSeriesID.HasValue && DefaultSeriesID.Value != 0) { defaultSeries = allSeriesList .FirstOrDefault(series => series.AnimeSeriesID == DefaultSeriesID.Value); @@ -380,7 +380,8 @@ public CreateOrUpdateGroupBody(SVR_AnimeGroup group) // Set the main series and maybe update the group // name/description. - group.SetMainSeries(defaultSeries); + if (DefaultSeriesID.HasValue) + group.SetMainSeries(defaultSeries); // Update stats for all groups in the chain. group.TopLevelAnimeGroup.UpdateStatsFromTopLevel(true, true);