muc: Don't show unnecessary affiliation change message

This commit is contained in:
JC Brand 2020-05-07 10:03:28 +02:00
parent b64b20c44d
commit 3319398f17

View File

@ -2058,6 +2058,16 @@ converse.plugins.add('converse-muc', {
createAffiliationChangeMessage (occupant) { createAffiliationChangeMessage (occupant) {
const previous_affiliation = occupant._previousAttributes.affiliation; const previous_affiliation = occupant._previousAttributes.affiliation;
if (!previous_affiliation) {
// If no previous affiliation was set, then we don't
// interpret this as an affiliation change.
// For example, if muc_send_probes is true, then occupants
// are created based on incoming messages, in which case
// we don't yet know the affiliation
return
}
const current_affiliation = occupant.get('affiliation'); const current_affiliation = occupant.get('affiliation');
if (previous_affiliation === 'admin') { if (previous_affiliation === 'admin') {
this.createMessage({ this.createMessage({