Skip to content

Commit

Permalink
[FIX] double send bug on message box (#15409)
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan authored and ggazzo committed Sep 19, 2019
1 parent fa78ecd commit 04a0acd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/ui-message/client/messageBox/messageBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ Template.messageBox.onCreated(function() {
autogrow.update();
};

let isSending = false;

this.send = (event) => {
const { input } = this;

Expand All @@ -93,9 +95,16 @@ Template.messageBox.onCreated(function() {
const { autogrow, data: { rid, tmid, onSend } } = this;
const { value } = input;
this.set('');
onSend && onSend.call(this.data, event, { rid, tmid, value }, () => {

if (!onSend || isSending) {
return;
}

isSending = true;
onSend.call(this.data, event, { rid, tmid, value }, () => {
autogrow.update();
input.focus();
isSending = false;
});
};
});
Expand Down
3 changes: 3 additions & 0 deletions app/ui/client/lib/chatMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,13 @@ export class ChatMessages {

this.resetToDraft(this.editing.id);
this.confirmDeleteMsg(message, done);
return;
} catch (error) {
handleError(error);
}
}

return done();
}

async processMessageSend(message) {
Expand Down

0 comments on commit 04a0acd

Please sign in to comment.