Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Send message with pending messages #16474

Merged
merged 1 commit into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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