Update selection list after an action (fix #80, #81, #83)

This commit is contained in:
Athozus 2023-05-02 10:38:08 +02:00
parent ec92aaba05
commit c670d48622
No known key found for this signature in database
GPG key ID: B50895022E8484BF
3 changed files with 35 additions and 0 deletions

View file

@ -104,5 +104,21 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter)
else
formspec[#formspec + 1] = "]label[2.25,4.5;" .. S("No mail") .. "]"
end
if mail.selected_idxs.inbox[name] and #mail.selected_idxs.inbox[name] > 0 then
for i, selected_msg in ipairs(mail.selected_idxs.inbox[name]) do
local is_present = false
for _, msg in ipairs(messages) do
if msg.id == selected_msg then
is_present = true
break
end
end
if not is_present then
table.remove(mail.selected_idxs.inbox[name], i)
end
end
end
minetest.show_formspec(name, "mail:inbox", table.concat(formspec, ""))
end