Skip to content

Commit

Permalink
fix: only set main series if default series was requested to be changed.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
revam committed Oct 8, 2023
1 parent 3466997 commit e1a10ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Shoko.Server/API/v3/Models/Shoko/Group.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e1a10ca

Please sign in to comment.