From 4a53d4cb56ce677a655d88ea7b818e9666fe40c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chmielowski?= Date: Wed, 24 May 2023 11:26:48 +0200 Subject: [PATCH] Expand rule "mucsub subscribers are members in members only rooms" to more places --- src/mod_muc_room.erl | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index f66e32036..b26e02f76 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -1695,13 +1695,23 @@ set_affiliations_fallback(Affiliations, StateData) -> -spec get_affiliation(ljid() | jid(), state()) -> affiliation(). get_affiliation(#jid{} = JID, StateData) -> case get_service_affiliation(JID, StateData) of - owner -> - owner; - none -> - case do_get_affiliation(JID, StateData) of - {Affiliation, _Reason} -> Affiliation; - Affiliation -> Affiliation - end + owner -> + owner; + none -> + Aff = case do_get_affiliation(JID, StateData) of + {Affiliation, _Reason} -> Affiliation; + Affiliation -> Affiliation + end, + case {Aff, (StateData#state.config)#config.members_only} of + % Subscribers should be have members affiliation in this case + {none, true} -> + case is_subscriber(JID, StateData) of + true -> member; + _ -> none + end; + _ -> + Aff + end end; get_affiliation(LJID, StateData) -> get_affiliation(jid:make(LJID), StateData).