From 75a527e82801513e6c09f44c61b9c5654801de10 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Mon, 16 Sep 2019 10:18:46 +1000 Subject: [PATCH] Replaced value with a descriptive constant. --- js/modules/loki_public_chat_api.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/modules/loki_public_chat_api.js b/js/modules/loki_public_chat_api.js index 5bd563537..250baf1a3 100644 --- a/js/modules/loki_public_chat_api.js +++ b/js/modules/loki_public_chat_api.js @@ -9,6 +9,7 @@ const PUBLICCHAT_MSG_POLL_EVERY = 1.5 * 1000; // 1.5s const PUBLICCHAT_CHAN_POLL_EVERY = 20 * 1000; // 20s const PUBLICCHAT_DELETION_POLL_EVERY = 5 * 1000; // 5s const PUBLICCHAT_MOD_POLL_EVERY = 30 * 1000; // 30s +const PUBLICCHAT_MIN_TIME_BETWEEN_DUPLICATE_MESSAGES = 10 * 1000; // 10s // singleton to relay events to libtextsecure/message_receiver class LokiPublicChatAPI extends EventEmitter { @@ -585,7 +586,8 @@ class LokiPublicChannelAPI { const sameText = message.text === adnMessage.text; // Don't filter out messages that are too far apart from each other const timestampsSimilar = - Math.abs(message.timestamp - timestamp) <= 10000; + Math.abs(message.timestamp - timestamp) <= + PUBLICCHAT_MIN_TIME_BETWEEN_DUPLICATE_MESSAGES; return sameUsername && sameText && timestampsSimilar; };