mirror of
https://github.com/readest/readest.git
synced 2026-11-29 19:02:28 +00:00
* feat(library): remove selected books from the device only (#7318) Bulk delete in selection mode always deleted from cloud and device; the device-only removal was only in Book Details, one book at a time. The bulk delete confirmation now has a "Remove from Device Only" toggle. It runs the existing local delete for the selected books that have a cloud copy (or an Audiobookshelf offline download) and skips the rest, so a bulk action never leaves a book with no copy anywhere. With it on, the purge toggle and the delete message are hidden and the button reads "Remove". Verified: - Tests written first. Before the change, library-utils.test.ts failed with "canRemoveFromDeviceOnly is not a function" and DeleteConfirmAlert.test.tsx with "Unable to find ... checkbox 'Remove from Device Only'"; the hidden-message check failed with "expected <div class="text-start text-sm"></div> to be null". All pass now (176 tests across library-utils, DeleteConfirmAlert, Bookshelf and BookDetailModal), plus alert-width-stability browser test (3 tests). - pnpm lint and pnpm format:check clean. - dev-web with Playwright on a fresh profile: imported 3 EPUBs, gave 2 a stand-in cloud copy (uploadedAt), selected all 9 books, turned the toggle on and confirmed. The 2 lost their local file and downloadedAt and stayed in the library; the local-only book and the demo books were untouched. Dialog checked in light, dark, e-ink (data-eink), RTL and at 390 px. - Not run: a real cloud account (the cloud copy was faked), native desktop/Android/iOS builds, and confirming the toggle-off Delete path in the app (covered by the unit test). Reported by poife on GitHub. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(library): keep Enter on a delete toggle and a cancelled delete from misfiring Two CodeRabbit findings on #7324: - Alert confirms on any Enter, so Enter on the focused "Remove from Device Only" toggle ran a cloud-and-device delete. Enter on a toggle now flips it instead (capture phase, ahead of Alert's listener). - Cancel set the abort flag even with no deletion running, so the next confirmed bulk delete stopped before its first batch and deleted nothing. runDeletion now clears the flag when it starts. Verified: - DeleteConfirmAlert.test.tsx "toggles instead of confirming when Enter is pressed on a toggle" failed before the fix with 'expected "vi.fn()" to not be called at all, but actually been called 1 times'. - library.test.tsx "deletes the books after an earlier delete confirmation was cancelled" failed before the fix with 'expected "vi.fn()" to be called 2 times, but got 0 times'. - Both pass now, with 178 tests across the four related suites and the alert-width browser test; pnpm lint and pnpm format:check clean. - dev-web with Playwright: Cancel, reopen, focus the toggle, press Enter: the toggle turned on and the dialog stayed open; Remove then dropped the local files of the 2 books with a cloud copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(library): keep each bulk deletion's cancel to its own run CodeRabbit on #7324: clearing a shared abort flag at the start of a run let a cancelled run continue with its remaining batches when a new deletion started before its current batch finished, and the old run could then close the newer alert. Each run now takes a token; Cancel and any newer run make it stale, so it stops before its next batch and leaves the alert alone. Also fixes the Romanian plural forms of the new string ("al 1 carte" was ungrammatical). Verified: - library.test.tsx "stops a cancelled deletion even when another one starts before its batch ends" failed before the fix with 'expected "vi.fn()" to be called 21 times, but got 41 times' and passes now; 179 tests across the four related suites pass; pnpm lint and pnpm format:check clean. - dev-web with Playwright: Cancel, reopen, Enter on the toggle, Remove still drops the local files of the 2 books with a cloud copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| .agents | ||
| .claude | ||
| bench | ||
| data/wordlens | ||
| docs | ||
| e2e | ||
| extensions | ||
| public | ||
| scripts | ||
| src | ||
| src-tauri | ||
| workers | ||
| .env | ||
| .env.local.example | ||
| .env.tauri | ||
| .env.tauri.example | ||
| .env.web | ||
| .env.web.example | ||
| .gitignore | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| components.json | ||
| DESIGN.md | ||
| i18n-langs.json | ||
| i18next-scanner.config.cjs | ||
| LESSONS.md | ||
| next.config.mjs | ||
| open-next.config.ts | ||
| package.json | ||
| pdfjs.d.ts | ||
| playwright.config.ts | ||
| postcss.config.mjs | ||
| PRODUCT.md | ||
| raw-loader.d.ts | ||
| release-notes.json | ||
| skills-lock.json | ||
| TODOS.md | ||
| tsconfig.json | ||
| vite.config.ts | ||
| vitest.android.config.mts | ||
| vitest.browser.config.mts | ||
| vitest.config.mts | ||
| vitest.env.mts | ||
| vitest.setup.ts | ||
| vitest.tauri.config.mts | ||
| vitest.tauri.setup.ts | ||
| wdio.conf.ts | ||
| worker.ts | ||
| wrangler.toml | ||