1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-02-22 22:10:12 +00:00

Fix change_archived so state=none is a toggle. Fixes /togglearchived endpoint

This commit is contained in:
James Armstong 2024-08-03 11:50:28 -07:00
parent 2ae80d3007
commit 2afce66486

View File

@ -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