mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
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:
@@ -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") },
|
||||
|
||||
Reference in New Issue
Block a user