Optionally remove migrated manga from categories
In case the setting is enabled, the manga should be removed from all categories on migration
This commit is contained in:
@@ -440,7 +440,8 @@ export class Mangas {
|
||||
}: Omit<MigrateOptions, 'mangaIdToMigrateTo'>,
|
||||
): Promise<void> {
|
||||
return Mangas.executeAction('migrate', 1, async () => {
|
||||
const [{ data: mangaToMigrateData }, { data: mangaToMigrateToData }] = await Promise.all([
|
||||
const [{ data: mangaToMigrateData }, { data: mangaToMigrateToData }, { removeMangaFromCategories }] =
|
||||
await Promise.all([
|
||||
requestManager.getMangaToMigrate(mangaId, {
|
||||
migrateChapters,
|
||||
migrateCategories,
|
||||
@@ -452,6 +453,7 @@ export class Mangas {
|
||||
migrateCategories,
|
||||
migrateTracking,
|
||||
}).response,
|
||||
getMetadataServerSettings(),
|
||||
]);
|
||||
|
||||
if (!mangaToMigrateData.manga || !mangaToMigrateToData?.fetchManga?.manga) {
|
||||
@@ -482,7 +484,10 @@ export class Mangas {
|
||||
? requestManager.updateManga(mangaIdToMigrateTo, { updateManga: { inLibrary: true } }).response
|
||||
: undefined,
|
||||
mode === 'migrate'
|
||||
? requestManager.updateManga(mangaId, { updateManga: { inLibrary: false } }).response
|
||||
? requestManager.updateManga(mangaId, {
|
||||
updateManga: { inLibrary: false },
|
||||
updateMangaCategories: removeMangaFromCategories ? { clearCategories: true } : undefined,
|
||||
}).response
|
||||
: undefined,
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user