Open mzealey opened 11 months ago
We are using maybe_send_affiliation
instead of send_affiliation
because send_update_presence
called above also can send those notification, so if we would use send_affiliation we could send those notifications twice. What i think is happening here is that notifications should be generated by send_update_presence
but most likely is_room_overcrowded
check (aka room has more participants that what mod_muc
option max_users_presence
define), tells that function to not generate presences. I will need to think what we should be doing there...
I thought this overcrowding may be the case on our production servers, however I can reliably reproduce this bug with just 2 users in a fresh chatroom on a local docker-compose platform, and the config above.
And in the overcrowded state, I would think the correct approach is to at least send the notification to all admins + the new person as their UI may need to update to give them the extra features available to admins.
Environment
erlang:25.3.2.3
Configuration (only if needed): grep -Ev '^$|^\s*#' ejabberd.yml
MUC config:
Bug description
User2 joins a group via mucsub:
User 1 promotes them to admin:
However user 2 never receives a presence/affiliation notification because of the following code in src/mod_muc_room.erl:
If we replace
maybe_send_affiliation
withsend_affiliation
then all users in the chat group receive:which is what we expected to happen.
I notice that the code also tries to send presence updates, however we never receive them (probably because it's mucsub rather than muc?). Either way, for mucsub we believe that affiliation is the correct approach because these messages are stored in the offline queue so will be guaranteed to be delivered to the user unlike presence notifications.