From 0a7adc9474efeaacb0fbd158b5c565ef7cde346c Mon Sep 17 00:00:00 2001 From: Anton Grigoryev Date: Mon, 13 Sep 2021 18:40:24 +0300 Subject: [PATCH] fix: handle multi-send on quick reply (#532) --- public/modules/quickreply.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/modules/quickreply.js b/public/modules/quickreply.js index 185c999..0e17dd1 100644 --- a/public/modules/quickreply.js +++ b/public/modules/quickreply.js @@ -30,15 +30,23 @@ define('persona/quickreply', [ // data.element.textcomplete(data.strategies, data.options); // $('.textcomplete-wrapper').css('height', '100%').find('textarea').css('height', '100%'); + var ready = true; components.get('topic/quickreply/button').on('click', function(e) { e.preventDefault(); + if (!ready) { + return; + } + var replyMsg = components.get('topic/quickreply/text').val(); var replyData = { tid: ajaxify.data.tid, handle: undefined, content: replyMsg }; + + ready = false; api.post(`/topics/${ajaxify.data.tid}`, replyData, function (err, data) { + ready = true; if (err) { return app.alertError(err.message); }