Content server: Fix re-opening book from home page after making progress not opening to correct last read position when a user is logged in. Fixes 2011755

This commit is contained in:
Kovid Goyal 2023-04-02 14:29:50 +05:30
parent 8e18a509cb
commit 8e1982c700
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 0 deletions

View File

@ -42,6 +42,12 @@ def update_recently_read_by_user(items):
recently_read_by_user.updated = True
def update_book_in_recently_read_by_user_on_home_page(library_id, book_id, book_format, cfi):
for item in recently_read_by_user.items:
if item.library_id is library_id and item.book_id is book_id and item.format is book_format:
item.cfi = cfi
def show_cover(blob, name, mt, book):
img = document.getElementById(this)
if not img:

View File

@ -7,6 +7,7 @@ from elementmaker import E
import read_book.iframe # noqa
from ajax import ajax_send
from book_list.globals import get_session_data
from book_list.home import update_book_in_recently_read_by_user_on_home_page
from book_list.theme import cached_color_to_rgba, get_color, set_ui_colors
from book_list.ui import query_as_href
from dom import add_extra_css, build_rule, clear, set_css, svgicon, unique_id
@ -1245,6 +1246,7 @@ class View:
if end_type is not 'load':
print('Failed to update last read position, AJAX call did not succeed')
)
update_book_in_recently_read_by_user_on_home_page(key[0], key[1], key[2], data.cfi)
@property
def current_position_data(self):