Don't set affiliation to 'none' if it's already 'none' in mod_muc_room:process_item_change/3

This commit is contained in:
Alexey Shchepin 2022-07-01 09:13:37 +03:00
parent e10c67a74a
commit 99d9e315a3
1 changed files with 20 additions and 16 deletions

View File

@ -3014,22 +3014,26 @@ process_item_change(Item, SD, UJID) ->
send_kickban_presence(UJID, JID, Reason, 307, SD), send_kickban_presence(UJID, JID, Reason, 307, SD),
set_role(JID, none, SD); set_role(JID, none, SD);
{JID, affiliation, none, Reason} -> {JID, affiliation, none, Reason} ->
case (SD#state.config)#config.members_only of case get_affiliation(JID, SD) of
true -> none -> SD;
send_kickban_presence(UJID, JID, Reason, 321, none, SD), _ ->
maybe_send_affiliation(JID, none, SD), case (SD#state.config)#config.members_only of
SD1 = set_affiliation(JID, none, SD), true ->
set_role(JID, none, SD1); send_kickban_presence(UJID, JID, Reason, 321, none, SD),
_ -> maybe_send_affiliation(JID, none, SD),
SD1 = set_affiliation(JID, none, SD), SD1 = set_affiliation(JID, none, SD),
SD2 = case (SD1#state.config)#config.moderated of set_role(JID, none, SD1);
true -> set_role(JID, visitor, SD1); _ ->
false -> set_role(JID, participant, SD1) SD1 = set_affiliation(JID, none, SD),
end, SD2 = case (SD1#state.config)#config.moderated of
send_update_presence(JID, Reason, SD2, SD), true -> set_role(JID, visitor, SD1);
maybe_send_affiliation(JID, none, SD2), false -> set_role(JID, participant, SD1)
SD2 end,
end; send_update_presence(JID, Reason, SD2, SD),
maybe_send_affiliation(JID, none, SD2),
SD2
end
end;
{JID, affiliation, outcast, Reason} -> {JID, affiliation, outcast, Reason} ->
send_kickban_presence(UJID, JID, Reason, 301, outcast, SD), send_kickban_presence(UJID, JID, Reason, 301, outcast, SD),
maybe_send_affiliation(JID, outcast, SD), maybe_send_affiliation(JID, outcast, SD),