From 2afce66486c91f818adea79a7cadda305ddc5e28 Mon Sep 17 00:00:00 2001 From: James Armstong Date: Sat, 3 Aug 2024 11:50:28 -0700 Subject: [PATCH] Fix change_archived so state=none is a toggle. Fixes /togglearchived endpoint --- cps/kobo_sync_status.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/kobo_sync_status.py b/cps/kobo_sync_status.py index 8c1ca7c5f..ee9f0779c 100644 --- a/cps/kobo_sync_status.py +++ b/cps/kobo_sync_status.py @@ -54,7 +54,7 @@ def remove_synced_book(book_id, all=False, session=None): def change_archived_books(book_id, state=None, message=None): archived_book = ub.session.query(ub.ArchivedBook).filter(and_(ub.ArchivedBook.user_id == int(current_user.id), ub.ArchivedBook.book_id == book_id)).first() - if not archived_book and state == True: + if not archived_book and (state == True or state == None): archived_book = ub.ArchivedBook(user_id=current_user.id, book_id=book_id) archived_book.is_archived = state if state != None else not archived_book.is_archived