Fix read messages becoming unread while migrating (#47)
This commit is contained in:
parent
56e86cd5e1
commit
bfabed9b52
@ -62,6 +62,12 @@ local function migrate_v2_to_v3()
|
|||||||
local player_inbox = read_json_file(maildir .. "/" .. saneplayername .. ".json")
|
local player_inbox = read_json_file(maildir .. "/" .. saneplayername .. ".json")
|
||||||
print("[mail,v2] + migrating player '" .. playername .. "'")
|
print("[mail,v2] + migrating player '" .. playername .. "'")
|
||||||
for _, msg in ipairs(player_inbox) do
|
for _, msg in ipairs(player_inbox) do
|
||||||
|
local reading_status = false
|
||||||
|
if msg.unread then
|
||||||
|
reading_status = false
|
||||||
|
else
|
||||||
|
reading_status = true
|
||||||
|
end
|
||||||
table.insert(entry.inbox, {
|
table.insert(entry.inbox, {
|
||||||
id = mail.new_uuid(),
|
id = mail.new_uuid(),
|
||||||
from = msg.sender or msg.from,
|
from = msg.sender or msg.from,
|
||||||
@ -70,6 +76,7 @@ local function migrate_v2_to_v3()
|
|||||||
subject = msg.subject,
|
subject = msg.subject,
|
||||||
body = msg.body,
|
body = msg.body,
|
||||||
time = msg.time or os.time(),
|
time = msg.time or os.time(),
|
||||||
|
read = reading_status,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user