From 3319398f175cf0090ff630635114a524ddb65a44 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 7 May 2020 10:03:28 +0200 Subject: [PATCH] muc: Don't show unnecessary affiliation change message --- src/headless/converse-muc.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/headless/converse-muc.js b/src/headless/converse-muc.js index 0fe07e4ac..510929665 100644 --- a/src/headless/converse-muc.js +++ b/src/headless/converse-muc.js @@ -2058,6 +2058,16 @@ converse.plugins.add('converse-muc', { createAffiliationChangeMessage (occupant) { 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'); if (previous_affiliation === 'admin') { this.createMessage({