25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Persist none role for outcasts

`none` roles *should* be persisted for banned users. I totally forgot about this, my bad. I'm shocked nobody else noticed it.
This commit is contained in:
Blake Miller 2023-03-19 01:40:19 -04:00 committed by badlop
parent 04b431f191
commit f953dc3f5e

View File

@ -1751,10 +1751,12 @@ set_role(JID, Role, StateData) ->
end, StateData#state.users, LJIDs),
StateData#state.nicks}
end,
Affiliation = get_affiliation(JID, StateData),
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 ->
%% maintain the same role they had *before* they were kicked,
%% unless they were banned
none when Affiliation /= outcast ->
StateData#state.roles;
NewRole ->
maps:put(jid:remove_resource(LJID),
@ -3070,7 +3072,7 @@ process_item_change(Item, SD, UJID) ->
process_iq_mucsub(JID,
#iq{type = set,
sub_els = [#muc_unsubscribe{}]}, SD),
set_affiliation(JID, outcast, set_role(JID, none, SD2), Reason);
set_role(JID, none, set_affiliation(JID, outcast, SD2, Reason));
{JID, affiliation, A, Reason} when (A == admin) or (A == owner) ->
SD1 = set_affiliation(JID, A, SD, Reason),
SD2 = set_role(JID, moderator, SD1),