From 7ad7b489b099b650279393af8cb4562e54af2710 Mon Sep 17 00:00:00 2001 From: esainane Date: Wed, 4 Dec 2019 14:38:54 +1300 Subject: [PATCH 1/2] Fix UserListPanel sorting Offline users have a nil isAdmin, non-admins have a false isAdmin. This caused comparisons to often enter the admin branch prematurely, breaking alphabetical etc ordering. --- LuaMenu/widgets/chobby/components/user_list_panel.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LuaMenu/widgets/chobby/components/user_list_panel.lua b/LuaMenu/widgets/chobby/components/user_list_panel.lua index 713c87a67..50beabd58 100644 --- a/LuaMenu/widgets/chobby/components/user_list_panel.lua +++ b/LuaMenu/widgets/chobby/components/user_list_panel.lua @@ -71,7 +71,7 @@ local function CompareUsers(userName, otherName) return true end - if otherData.isAdmin ~= userData.isAdmin then + if (not not otherData.isAdmin) ~= (not not userData.isAdmin) then return userData.isAdmin end From c77641805ffaf834ebba5426c88bdb5438882703 Mon Sep 17 00:00:00 2001 From: esainane Date: Wed, 4 Dec 2019 14:50:24 +1300 Subject: [PATCH 2/2] UserListPanel: `not`, not `not not` Once is enough to coerce to a boolean, twice is superfluous for a simple equality test. --- LuaMenu/widgets/chobby/components/user_list_panel.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LuaMenu/widgets/chobby/components/user_list_panel.lua b/LuaMenu/widgets/chobby/components/user_list_panel.lua index 50beabd58..915f79cb0 100644 --- a/LuaMenu/widgets/chobby/components/user_list_panel.lua +++ b/LuaMenu/widgets/chobby/components/user_list_panel.lua @@ -71,11 +71,11 @@ local function CompareUsers(userName, otherName) return true end - if (not not otherData.isAdmin) ~= (not not userData.isAdmin) then + if (not otherData.isAdmin) ~= (not userData.isAdmin) then return userData.isAdmin end - if (not not otherData.isIgnored) ~= (not not userData.isIgnored) then + if (not otherData.isIgnored) ~= (not userData.isIgnored) then return otherData.isIgnored end