Skip to content

Commit

Permalink
Don't set affiliation to 'none' if it's already 'none' in mod_muc_roo…
Browse files Browse the repository at this point in the history
…m:process_item_change/3
  • Loading branch information
alexeyshch committed Jul 1, 2022
1 parent e10c67a commit 99d9e31
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/mod_muc_room.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3014,22 +3014,26 @@ process_item_change(Item, SD, UJID) ->
send_kickban_presence(UJID, JID, Reason, 307, SD),
set_role(JID, none, SD);
{JID, affiliation, none, Reason} ->
case (SD#state.config)#config.members_only of
true ->
send_kickban_presence(UJID, JID, Reason, 321, none, SD),
maybe_send_affiliation(JID, none, SD),
SD1 = set_affiliation(JID, none, SD),
set_role(JID, none, SD1);
_ ->
SD1 = set_affiliation(JID, none, SD),
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;
case get_affiliation(JID, SD) of
none -> SD;
_ ->
case (SD#state.config)#config.members_only of
true ->
send_kickban_presence(UJID, JID, Reason, 321, none, SD),
maybe_send_affiliation(JID, none, SD),
SD1 = set_affiliation(JID, none, SD),
set_role(JID, none, SD1);
_ ->
SD1 = set_affiliation(JID, none, SD),
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
end;
{JID, affiliation, outcast, Reason} ->
send_kickban_presence(UJID, JID, Reason, 301, outcast, SD),
maybe_send_affiliation(JID, outcast, SD),
Expand Down

0 comments on commit 99d9e31

Please sign in to comment.