aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2022-09-07 16:44:50 +0200
committerBadlop <badlop@process-one.net>2022-09-13 17:55:09 +0200
commita8121cd7e50787547d4bcc5a5defe194527c2ad4 (patch)
treedb31827460b6bd4aaf809ba7c84d1dc70d5a1937
parentStore role, and use it when joining a moderated room (#3330) (diff)
Don't persist 'none' role (thanks to Blake Miller)(#3330)
-rw-r--r--src/mod_muc_room.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl
index 044725bd4..94d574962 100644
--- a/src/mod_muc_room.erl
+++ b/src/mod_muc_room.erl
@@ -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().