From f3ce3eb80bb9e00cc204e754134acad08514c8f7 Mon Sep 17 00:00:00 2001 From: oof2win2 Date: Sat, 14 Aug 2021 14:06:13 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20GUI=20showing=20items=20?= =?UTF-8?q?when=20it=20shouldn't?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- expcore/gui/top_flow.lua | 3 ++- expcore/roles.lua | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/expcore/gui/top_flow.lua b/expcore/gui/top_flow.lua index 39bfb99f..064ee906 100644 --- a/expcore/gui/top_flow.lua +++ b/expcore/gui/top_flow.lua @@ -73,7 +73,8 @@ function Gui.update_top_flow(player) end -- Set the visible state - local allowed = type(authenticator) == 'function' and authenticator(player) or authenticator + local allowed = authenticator + if type(allowed) == 'function' then allowed = allowed(player) end element.visible = is_visible and allowed or false end end diff --git a/expcore/roles.lua b/expcore/roles.lua index 2028cd23..ad14ac09 100644 --- a/expcore/roles.lua +++ b/expcore/roles.lua @@ -114,6 +114,7 @@ local Event = require 'utils.event' --- @dep utils.event local Groups = require 'expcore.permission_groups' --- @dep expcore.permission_groups local Async = require 'expcore.async' --- @dep expcore.async local Colours = require 'utils.color_presets' --- @dep utils.color_presets +local Gui = require 'expcore.gui' --- @dep expcore.gui local write_json = _C.write_json --- @dep expcore.common local Roles = { @@ -378,6 +379,7 @@ function Roles.assign_player(player, roles, by_player_name, skip_checks, silent) end if valid_player then emit_player_roles_updated(valid_player, 'assign', roles, by_player_name, silent) + Gui.update_top_flow(valid_player) end end @@ -410,6 +412,7 @@ function Roles.unassign_player(player, roles, by_player_name, skip_checks, silen end if valid_player then emit_player_roles_updated(valid_player, 'unassign', roles, by_player_name, silent) + Gui.update_top_flow(valid_player) end end