Fix unselect all (9679251
)
This commit is contained in:
parent
968f402566
commit
984d8c34d9
@ -304,17 +304,19 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
|
|
||||||
elseif fields.selectall then
|
elseif fields.selectall then
|
||||||
if formname == "mail:inbox" then
|
if formname == "mail:inbox" then
|
||||||
|
local selected_number = #mail.selected_idxs.inbox[name]
|
||||||
mail.selected_idxs.inbox[name] = {} -- reset for select, unselect and not existing
|
mail.selected_idxs.inbox[name] = {} -- reset for select, unselect and not existing
|
||||||
mail.selected_idxs.multipleselection[name] = true -- enable as the button were pressed
|
mail.selected_idxs.multipleselection[name] = true -- enable as the button were pressed
|
||||||
if #mail.selected_idxs.inbox[name] < #getInbox() then -- then populate it if selection isn't full
|
if selected_number < #getInbox() then -- then populate it if selection isn't full
|
||||||
for _, msg in ipairs(getInbox()) do
|
for _, msg in ipairs(getInbox()) do
|
||||||
table.insert(mail.selected_idxs.inbox[name], msg.id)
|
table.insert(mail.selected_idxs.inbox[name], msg.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif formname == "mail:outbox" then
|
elseif formname == "mail:outbox" then
|
||||||
|
local selected_number = #mail.selected_idxs.outbox[name]
|
||||||
mail.selected_idxs.outbox[name] = {} -- reset for select, unselect and not existing
|
mail.selected_idxs.outbox[name] = {} -- reset for select, unselect and not existing
|
||||||
mail.selected_idxs.multipleselection[name] = true -- enable as the button were pressed
|
mail.selected_idxs.multipleselection[name] = true -- enable as the button were pressed
|
||||||
if #mail.selected_idxs.outbox[name] < #getOutbox() then -- then populate it if selection isn't full
|
if selected_number < #getOutbox() then -- then populate it if selection isn't full
|
||||||
for _, msg in ipairs(getOutbox()) do
|
for _, msg in ipairs(getOutbox()) do
|
||||||
table.insert(mail.selected_idxs.outbox[name], msg.id)
|
table.insert(mail.selected_idxs.outbox[name], msg.id)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user