Skip to content

Commit

Permalink
[FIX] Send message with pending messages (#16474)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo authored Feb 5, 2020
1 parent 58c877a commit 767730b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions app/ui-message/client/messageBox/messageBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ Template.messageBox.onCreated(function() {
autogrow.update();
};

let isSending = false;

this.send = (event) => {
const { input } = this;
Expand All @@ -95,15 +94,13 @@ Template.messageBox.onCreated(function() {
const { value } = input;
this.set('');

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

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

if (msg) {
readMessage.readNow(rid);
$('.message.first-unread').removeClass('first-unread');
readMessage.refreshUnreadMark(rid);

const message = await promises.run('onClientBeforeSendMessage', {
_id: Random.id(),
Expand Down Expand Up @@ -388,8 +388,8 @@ export class ChatMessages {
return false;
}

await call('updateMessage', message);
this.clearEditing();
await call('updateMessage', message);
return true;
}

Expand Down

0 comments on commit 767730b

Please sign in to comment.