Skip to content

Commit

Permalink
Merge pull request #178 from Suwayomi/main
Browse files Browse the repository at this point in the history
migrate can Delete old Downloaded chapters
  • Loading branch information
Robonau authored Mar 16, 2024
2 parents b1886f2 + 4a4c4fb commit fda0931
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import Slide from '$lib/components/Slide.svelte';
import {
bindTrack,
deleteDownloadedChapters,
fetchChaptersMigration,
updateChapters,
updateMangaCategories,
Expand All @@ -22,6 +23,7 @@
import { getContextClient } from '@urql/svelte';
import { type ResultOf } from '$lib/gql/graphql';
import type { SvelteComponent } from 'svelte';
import { ErrorHelp } from '$lib/util';
const modalStore = getModalStore();
export let parent: SvelteComponent;
Expand All @@ -32,6 +34,7 @@
let doChapters = true;
let doCategories = true;
let doTracking = true;
let deleteDownloaded = manga.downloadCount > 0 ? true : false;
let MigrateLoading = false;
let CopyLoading = false;
Expand Down Expand Up @@ -76,9 +79,24 @@
if (doTracking) {
ToDo.push(CopyMangaTracking());
}
if (deleteDownloaded) {
ToDo.push(deleteDownloadedMangas());
}
await Promise.all(ToDo);
}
async function deleteDownloadedMangas() {
const ids = manga.chapters.nodes.map((e) => e.id);
await ErrorHelp(
'failed to delete Downloaded chapters',
client
.mutation(deleteDownloadedChapters, {
ids
})
.toPromise()
);
}
async function CopyMangaChapters() {
const newChapters = await client
.mutation(fetchChaptersMigration, { id })
Expand Down Expand Up @@ -167,6 +185,14 @@
>
Tracking
</Slide>
{#if manga.downloadCount > 0}
<Slide
class="p-1 pl-2 outline-0 hover:variant-glass-surface"
bind:checked={deleteDownloaded}
>
Delete old Downloaded chapters
</Slide>
{/if}
</div>
</div>
<div class="flex justify-between p-4">
Expand Down
2 changes: 1 addition & 1 deletion versionToServerVersionMapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
{
"tag": "v1.0.0",
"uiVersion": "r601",
"uiVersion": "r605",
"serverVersion": "r1498"
}
]

0 comments on commit fda0931

Please sign in to comment.