From fd4c5edc23545783a1f6291d576e1e7759a94cc1 Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 17 Sep 2019 10:41:27 +0200 Subject: [PATCH] Apply default role after revoking admin affiliation (#3023) --- src/mod_muc_room.erl | 10 +++++++--- test/muc_tests.erl | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index 808b8a246..2fc4e6e93 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -2916,9 +2916,13 @@ process_item_change(Item, SD, UJID) -> set_role(JID, none, SD1); _ -> SD1 = set_affiliation(JID, none, SD), - send_update_presence(JID, Reason, SD1, SD), - maybe_send_affiliation(JID, none, SD1), - SD1 + SD2 = case (SD1#state.config)#config.moderated of + true -> set_role(JID, visitor, SD1); + false -> set_role(JID, participant, SD1) + end, + send_update_presence(JID, Reason, SD2, SD), + maybe_send_affiliation(JID, none, SD2), + SD2 end; {JID, affiliation, outcast, Reason} -> send_kickban_presence(UJID, JID, Reason, 301, outcast, SD), diff --git a/test/muc_tests.erl b/test/muc_tests.erl index 1d586431b..ef57e9a7b 100644 --- a/test/muc_tests.erl +++ b/test/muc_tests.erl @@ -784,7 +784,7 @@ change_affiliation_master(Config) -> #muc_item{affiliation = Aff} -> ok end - end, [{member, participant, available}, {none, participant, available}, + end, [{member, participant, available}, {none, visitor, available}, {admin, moderator, available}, {owner, moderator, available}, {outcast, none, unavailable}]), ok = leave(Config),