fix(koreader): allow plugin API to reset read status to unread

The catalog read-status enum omitted unread, so a device write could only
be undone from the web dashboard. Add it to the settable enum and the
plugin status dialog, and mark Unread as current when a book has no
status row.

Closes #853
This commit is contained in:
neon
2026-08-02 17:38:45 +00:00
parent f4cfc3ca5d
commit 49e0b12e97
8 changed files with 203 additions and 4 deletions
@@ -708,10 +708,13 @@ end
function CatalogDetail:showSetStatusDialog(detail)
local dialog
local buttons = {}
-- A book with no status row comes back with readStatus nil, which the header
-- already renders as Unread. Fold it here too so the Unread row is marked.
local current = detail.readStatus or "unread"
for _, status in ipairs(SETTABLE_READ_STATUSES) do
table.insert(buttons, {
{
text = status.text .. (detail.readStatus == status.id and " *" or ""),
text = status.text .. (current == status.id and " *" or ""),
callback = function()
UIManager:close(dialog)
self:applyReadStatus(detail, status.id)
@@ -84,6 +84,7 @@ CatalogUtil.READ_STATUS_LABELS = {
-- Read statuses the user can set from the catalog detail page. Kept in sync
-- with the server's manual read-status enum.
CatalogUtil.SETTABLE_READ_STATUSES = {
{ id = "unread", text = _("Unread") },
{ id = "want_to_read", text = _("To read") },
{ id = "reading", text = _("Reading") },
{ id = "on_hold", text = _("On hold") },