mirror of
https://github.com/mt-mods/mail.git
synced 2025-05-01 17:01: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 = {},
|
to = {},
|
||||||
cc = {},
|
cc = {},
|
||||||
bcc = {},
|
bcc = {},
|
||||||
boxtab = {}
|
boxtab = {},
|
||||||
|
sortfield = {},
|
||||||
|
sortdirection = {}
|
||||||
},
|
},
|
||||||
|
|
||||||
message_drafts = {}
|
message_drafts = {}
|
||||||
|
|
|
@ -24,19 +24,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
|
||||||
-- then sort them
|
-- then sort them
|
||||||
|
|
||||||
if not sortfield then
|
local sortfield = fields.sortfield or mail.selected_idxs.sortfield[name] or "3"
|
||||||
local sortfield = fields.sortfield
|
local sortdirection = fields.sortdirection or mail.selected_idxs.sortdirection[name] or "1"
|
||||||
end
|
mail.selected_idxs.sortfield[name] = sortfield
|
||||||
if not sortdirection then
|
mail.selected_idxs.sortdirection[name] = sortdirection
|
||||||
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 messagesInbox = mail.sort_messages(messagesInboxFiltered, sortfield, sortdirection, filter)
|
local messagesInbox = mail.sort_messages(messagesInboxFiltered, sortfield, sortdirection, filter)
|
||||||
local messagesSent = mail.sort_messages(messagesOutboxFiltered, 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)
|
function mail.show_inbox(name, sortfield, sortdirection, filter)
|
||||||
if not sortfield or sortfield == "" or sortfield == "0" then
|
sortfield = sortfield or "3"
|
||||||
sortfield = "3"
|
sortdirection = sortdirection or "1"
|
||||||
end
|
|
||||||
if not sortdirection or sortdirection == "" or sortdirection == "0" then
|
|
||||||
sortdirection = "1"
|
|
||||||
end
|
|
||||||
|
|
||||||
if not filter then
|
if not filter then
|
||||||
filter = ""
|
filter = ""
|
||||||
|
|
|
@ -3,12 +3,8 @@ local S = minetest.get_translator("mail")
|
||||||
|
|
||||||
|
|
||||||
function mail.show_sent(name, sortfield, sortdirection, filter)
|
function mail.show_sent(name, sortfield, sortdirection, filter)
|
||||||
if not sortfield or sortfield == "" or sortfield == "0" then
|
sortfield = sortfield or "3"
|
||||||
sortfield = "3"
|
sortdirection = sortdirection or "1"
|
||||||
end
|
|
||||||
if not sortdirection or sortdirection == "" or sortdirection == "0" then
|
|
||||||
sortdirection = "1"
|
|
||||||
end
|
|
||||||
|
|
||||||
if not filter then
|
if not filter then
|
||||||
filter = ""
|
filter = ""
|
||||||
|
|
Loading…
Add table
Reference in a new issue