From 45d83eda645bf117dedea85cfb846d9a4a9cef5a Mon Sep 17 00:00:00 2001 From: Mikal Stordal Date: Tue, 17 Oct 2023 07:48:45 +0200 Subject: [PATCH] misc: remove the remaining of the sort name setter - Add back the sort name to the v3 group model, this time read-only. - Remove the sort name from the v3 create/modify group body, since it can no longer be edited by the user. --- Shoko.Server/API/v3/Models/Shoko/Group.cs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/Shoko.Server/API/v3/Models/Shoko/Group.cs b/Shoko.Server/API/v3/Models/Shoko/Group.cs index b999f6bd7..e6a41dd96 100644 --- a/Shoko.Server/API/v3/Models/Shoko/Group.cs +++ b/Shoko.Server/API/v3/Models/Shoko/Group.cs @@ -28,7 +28,7 @@ public class Group : BaseModel public GroupIDs IDs { get; set; } /// - /// The sort name for the group. + /// The sort name for the group. Cannot directly be set by the user. /// public string SortName { get; set; } @@ -91,6 +91,7 @@ public Group(HttpContext ctx, SVR_AnimeGroup group, bool randomiseImages = false IDs.TopLevelGroup = group.TopLevelAnimeGroup.AnimeGroupID; Name = group.GroupName; + SortName = group.GetSortName(); Description = group.Description; Sizes = ModelHelper.GenerateGroupSizes(allSeries, episodes, subGroupCount, userID); Size = allSeries.Count(series => series.AnimeGroupID == group.AnimeGroupID); @@ -178,16 +179,6 @@ public class CreateOrUpdateGroupBody /// public string? Name { get; set; } = null; - /// - /// The group's custom sort name. - /// - /// - /// The sort name will only be modified if either - /// or - /// is set to true, and the value is not set to null. - /// - public string? SortName { get; set; } = null; - /// /// The group's custom description. /// @@ -203,7 +194,7 @@ public class CreateOrUpdateGroupBody /// /// /// Leave it as null to conditionally set the value if - /// or is set, or + /// is set, or /// explictly set it to true to lock in the new/current /// names, or set it to false to reset the names back to the /// automatic naming based on the main series. @@ -322,7 +313,7 @@ public CreateOrUpdateGroupBody(SVR_AnimeGroup group) if (HasCustomName.HasValue) group.IsManuallyNamed = 1; - // The group name and/or the group sort name changed. + // The group name changed. var overrideName = !string.IsNullOrWhiteSpace(Name) && !string.Equals(group.GroupName, Name); if (overrideName) {