25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Don't persist 'none' role (thanks to Blake Miller)(#3330)

This commit is contained in:
Badlop 2022-09-07 16:44:50 +02:00
parent 4d3875f4ff
commit a8121cd7e5

View File

@ -1732,7 +1732,16 @@ set_role(JID, Role, StateData) ->
end, StateData#state.users, LJIDs),
StateData#state.nicks}
end,
Roles = maps:put(jid:remove_resource(LJID), Role, StateData#state.roles),
Roles = case Role of
%% Don't persist 'none' role: if someone is kicked, they will
%% maintain the same role they had *before* they were kicked
none ->
StateData#state.roles;
NewRole ->
maps:put(jid:remove_resource(LJID),
NewRole,
StateData#state.roles)
end,
StateData#state{users = Users, nicks = Nicks, roles = Roles}.
-spec get_role(jid(), state()) -> role().