From de7a1f754569d1a0ebd90be7dcaae80d28dfeda8 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Fri, 21 Jul 2017 17:58:46 +0200 Subject: [PATCH] Check specifically for the Slack identity when working around its quirks --- src/converse-muc.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/converse-muc.js b/src/converse-muc.js index e24375829..8e8d425b9 100755 --- a/src/converse-muc.js +++ b/src/converse-muc.js @@ -1971,17 +1971,21 @@ * gateway, which doesn't use message IDs but instead the * aforementioned "ts" attributes. */ - const ts = message.getAttribute('ts'); - if (_.isNull(ts)) { - return false; - } else { - return this.model.messages.where({ - 'sender': 'me', - 'message': this.model.getMessageBody(message) - }).filter( - (msg) => Math.abs(moment(msg.get('time')).diff(moment.unix(ts))) < 2000 - ).length > 0; + const entity = _converse.disco_entities.get(_converse.domain); + if (entity.identities.where({'name': "Slack-XMPP"})) { + const ts = message.getAttribute('ts'); + if (_.isNull(ts)) { + return false; + } else { + return this.model.messages.where({ + 'sender': 'me', + 'message': this.model.getMessageBody(message) + }).filter( + (msg) => Math.abs(moment(msg.get('time')).diff(moment.unix(ts))) < 5000 + ).length > 0; + } } + return false; }, isDuplicate (message) {