From aa50942400912a3821a4a0267308c167aaf722c2 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 11 Oct 2018 13:21:44 +0200 Subject: [PATCH] Don't show join message for non-online occupants created from members list Fixes #1169 --- CHANGES.md | 1 + dist/converse.js | 10 ++++++++-- src/converse-muc-views.js | 8 +++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 76d79b74d..1cbdc1473 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ - Bugfix. MUC features weren't being refreshed when saving the config form - #1063 URLs in the topic / subject are not clickable - #1140 Add support for destroyed chatrooms +- #1169 Non-joined participants display an unwanted status message - #1190 MUC Participants column disappears in certain viewport widths - #1199 Can't get back from to login screen from registration screen - #1204 Link encoding issue diff --git a/dist/converse.js b/dist/converse.js index cb0b2b121..49bb6a579 100644 --- a/dist/converse.js +++ b/dist/converse.js @@ -68681,7 +68681,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ this.model.on('configurationNeeded', this.getAndRenderConfigurationForm, this); this.model.on('destroy', this.hide, this); this.model.on('show', this.show, this); - this.model.occupants.on('add', this.showJoinNotification, this); + this.model.occupants.on('add', this.onOccupantAdded, this); this.model.occupants.on('remove', this.showLeaveNotification, this); this.model.occupants.on('change:show', this.showJoinOrLeaveNotification, this); this.model.occupants.on('change:role', this.informOfOccupantsRoleChange, this); @@ -69700,8 +69700,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } }, + onOccupantAdded(occupant) { + if (occupant.get('show') === 'online') { + this.showJoinNotification(occupant); + } + }, + showJoinOrLeaveNotification(occupant) { - if (!occupant.isMember() || _.includes(occupant.get('states'), '303')) { + if (_.includes(occupant.get('states'), '303')) { return; } diff --git a/src/converse-muc-views.js b/src/converse-muc-views.js index cabbb4236..8ff3e7aca 100644 --- a/src/converse-muc-views.js +++ b/src/converse-muc-views.js @@ -540,7 +540,7 @@ this.model.on('destroy', this.hide, this); this.model.on('show', this.show, this); - this.model.occupants.on('add', this.showJoinNotification, this); + this.model.occupants.on('add', this.onOccupantAdded, this); this.model.occupants.on('remove', this.showLeaveNotification, this); this.model.occupants.on('change:show', this.showJoinOrLeaveNotification, this); this.model.occupants.on('change:role', this.informOfOccupantsRoleChange, this); @@ -1476,6 +1476,12 @@ } }, + onOccupantAdded (occupant) { + if (occupant.get('show') === 'online') { + this.showJoinNotification(occupant); + } + }, + showJoinOrLeaveNotification (occupant) { if (_.includes(occupant.get('states'), '303')) { return;