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:
parent
4d3875f4ff
commit
a8121cd7e5
@ -1732,7 +1732,16 @@ set_role(JID, Role, StateData) ->
|
|||||||
end, StateData#state.users, LJIDs),
|
end, StateData#state.users, LJIDs),
|
||||||
StateData#state.nicks}
|
StateData#state.nicks}
|
||||||
end,
|
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}.
|
StateData#state{users = Users, nicks = Nicks, roles = Roles}.
|
||||||
|
|
||||||
-spec get_role(jid(), state()) -> role().
|
-spec get_role(jid(), state()) -> role().
|
||||||
|
Loading…
Reference in New Issue
Block a user