feat(readarr): add the delete book handler

Handles the delete book prompt opened from the author details view,
toggling whether to delete files on disk and whether to add a list
exclusion before confirming.

Backing out of the prompt resets both toggles, so preferences from an
abandoned delete cannot leak into the next one.
This commit is contained in:
Dark-Alex-17 committed 2026-09-03 17:29:31 -06:00
1 parent 6a7f9fe0da
commit 7500e2da24
4 files changed
+636 -2

No files matched your search

@@ -15,7 +15,8 @@ mod tests {
use crate::models::readarr_models::{Author, AuthorStatistics, AuthorStatus};
use crate::models::servarr_data::readarr::readarr_data::{
ADD_AUTHOR_BLOCKS, AUTHOR_DETAILS_BLOCKS, ActiveReadarrBlock, BOOK_DETAILS_BLOCKS,
DELETE_AUTHOR_BLOCKS, EDIT_AUTHOR_BLOCKS, EDITION_DETAILS_BLOCKS, LIBRARY_BLOCKS,
DELETE_AUTHOR_BLOCKS, DELETE_BOOK_BLOCKS, EDIT_AUTHOR_BLOCKS, EDITION_DETAILS_BLOCKS,
LIBRARY_BLOCKS,
};
use crate::test_handler_delegation;
@@ -907,6 +908,15 @@ mod tests {
);
}
#[test]
fn test_delegates_delete_book_blocks_to_delete_book_handler() {
test_handler_delegation!(
LibraryHandler,
ActiveReadarrBlock::Authors,
ActiveReadarrBlock::DeleteBookPrompt
);
}
#[test]
fn test_delegates_edit_author_blocks_to_edit_author_handler() {
test_handler_delegation!(
@@ -925,6 +935,7 @@ mod tests {
library_handler_blocks.extend(EDITION_DETAILS_BLOCKS);
library_handler_blocks.extend(ADD_AUTHOR_BLOCKS);
library_handler_blocks.extend(DELETE_AUTHOR_BLOCKS);
library_handler_blocks.extend(DELETE_BOOK_BLOCKS);
library_handler_blocks.extend(EDIT_AUTHOR_BLOCKS);
ActiveReadarrBlock::iter().for_each(|readarr_block| {