From f953dc3f5ee1d220add70f4e55a53463ec25e3f3 Mon Sep 17 00:00:00 2001 From: Blake Miller <96107547+based-a-tron@users.noreply.github.com> Date: Sun, 19 Mar 2023 01:40:19 -0400 Subject: [PATCH] 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. --- src/mod_muc_room.erl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index a80559f5b..24b81db50 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -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),