From f9dbc6bc78c8d6901cc8ccb1748066ffc7d94ab8 Mon Sep 17 00:00:00 2001 From: Michael Shavit Date: Sun, 26 Jan 2020 16:20:10 -0500 Subject: [PATCH] Clean-up book from ArchivedBook on hard-delete. This change also adds a warning to the hard-delete prompt that deleted books should first be archived if the Kobo Sync feature is enabled. An alternative would be to keep a permanent record of hard-deleted book. --- cps/editbooks.py | 2 ++ cps/templates/book_edit.html | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cps/editbooks.py b/cps/editbooks.py index 0bb005fb..cfbae1e6 100644 --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -159,6 +159,7 @@ def delete_book(book_id, book_format): # delete book from Shelfs, Downloads, Read list ub.session.query(ub.BookShelf).filter(ub.BookShelf.book_id == book_id).delete() ub.session.query(ub.ReadBook).filter(ub.ReadBook.book_id == book_id).delete() + ub.session.query(ub.ArchivedBook).filter(ub.ReadBook.book_id == book_id).delete() ub.delete_download(book_id) ub.session.commit() @@ -241,6 +242,7 @@ def render_edit_book(book_id): return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc, title=_(u"edit metadata"), page="editbook", conversion_formats=allowed_conversion_formats, + config=config, source_formats=valid_source_formats) diff --git a/cps/templates/book_edit.html b/cps/templates/book_edit.html index 78b427eb..efe86aed 100644 --- a/cps/templates/book_edit.html +++ b/cps/templates/book_edit.html @@ -185,8 +185,16 @@ {{_('Are you really sure?')}}