From 76595233fc028a24156a3421baa67c85c90aa486 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sun, 29 Oct 2023 16:02:31 +0100 Subject: [PATCH] Prevent mangas from being added to the default category (#741) Mangas are not supposed to be mapped to the default category in the database. In case this happens, the category query won't be able to correctly select mangas in the default category --- .../suwayomi/tachidesk/graphql/mutations/CategoryMutation.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/CategoryMutation.kt b/server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/CategoryMutation.kt index 311e3224..d852fb46 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/CategoryMutation.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/CategoryMutation.kt @@ -16,6 +16,7 @@ import suwayomi.tachidesk.graphql.types.CategoryMetaType import suwayomi.tachidesk.graphql.types.CategoryType import suwayomi.tachidesk.graphql.types.MangaType import suwayomi.tachidesk.manga.impl.Category +import suwayomi.tachidesk.manga.impl.Category.DEFAULT_CATEGORY_ID import suwayomi.tachidesk.manga.impl.util.lang.isEmpty import suwayomi.tachidesk.manga.impl.util.lang.isNotEmpty import suwayomi.tachidesk.manga.model.dataclass.IncludeInUpdate @@ -371,7 +372,7 @@ class CategoryMutation { if (!patch.addToCategories.isNullOrEmpty()) { val newCategories = buildList { - ids.forEach { mangaId -> + ids.filter { it != DEFAULT_CATEGORY_ID }.forEach { mangaId -> patch.addToCategories.forEach { categoryId -> val existingMapping = CategoryMangaTable.select {