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