mirror of
https://github.com/mt-mods/mail.git
synced 2025-05-01 00:41:43 -04:00
Move sorting dropdown values to selected_idxs
This commit is contained in:
parent
779ba48a2c
commit
b7e047e167
4 changed files with 11 additions and 26 deletions
4
init.lua
4
init.lua
|
@ -21,7 +21,9 @@ mail = {
|
|||
to = {},
|
||||
cc = {},
|
||||
bcc = {},
|
||||
boxtab = {}
|
||||
boxtab = {},
|
||||
sortfield = {},
|
||||
sortdirection = {}
|
||||
},
|
||||
|
||||
message_drafts = {}
|
||||
|
|
|
@ -24,19 +24,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
|
||||
-- then sort them
|
||||
|
||||
if not sortfield then
|
||||
local sortfield = fields.sortfield
|
||||
end
|
||||
if not sortdirection then
|
||||
local sortdirection = fields.sortdirection
|
||||
end
|
||||
|
||||
if not fields.sortfield or fields.sortfield == "" then
|
||||
sortfield = "3"
|
||||
end
|
||||
if not fields.sortdirection or fields.sortdirection == "" then
|
||||
sortdirection = "1"
|
||||
end
|
||||
local sortfield = fields.sortfield or mail.selected_idxs.sortfield[name] or "3"
|
||||
local sortdirection = fields.sortdirection or mail.selected_idxs.sortdirection[name] or "1"
|
||||
mail.selected_idxs.sortfield[name] = sortfield
|
||||
mail.selected_idxs.sortdirection[name] = sortdirection
|
||||
|
||||
local messagesInbox = mail.sort_messages(messagesInboxFiltered, sortfield, sortdirection, filter)
|
||||
local messagesSent = mail.sort_messages(messagesOutboxFiltered, sortfield, sortdirection, filter)
|
||||
|
|
|
@ -3,12 +3,8 @@ local S = minetest.get_translator("mail")
|
|||
|
||||
|
||||
function mail.show_inbox(name, sortfield, sortdirection, filter)
|
||||
if not sortfield or sortfield == "" or sortfield == "0" then
|
||||
sortfield = "3"
|
||||
end
|
||||
if not sortdirection or sortdirection == "" or sortdirection == "0" then
|
||||
sortdirection = "1"
|
||||
end
|
||||
sortfield = sortfield or "3"
|
||||
sortdirection = sortdirection or "1"
|
||||
|
||||
if not filter then
|
||||
filter = ""
|
||||
|
|
|
@ -3,12 +3,8 @@ local S = minetest.get_translator("mail")
|
|||
|
||||
|
||||
function mail.show_sent(name, sortfield, sortdirection, filter)
|
||||
if not sortfield or sortfield == "" or sortfield == "0" then
|
||||
sortfield = "3"
|
||||
end
|
||||
if not sortdirection or sortdirection == "" or sortdirection == "0" then
|
||||
sortdirection = "1"
|
||||
end
|
||||
sortfield = sortfield or "3"
|
||||
sortdirection = sortdirection or "1"
|
||||
|
||||
if not filter then
|
||||
filter = ""
|
||||
|
|
Loading…
Add table
Reference in a new issue