Bug: Fix duplicate messages while using enter key on slow network (#987)

Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
This commit is contained in:
Sabin 2020-07-02 12:13:02 +05:45 committed by GitHub
parent a699d7bdfe
commit c0cd747f29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -212,18 +212,19 @@ export default {
if (this.message.length > this.maxLength) {
return;
}
const newMessage = this.message;
if (!this.showCannedResponsesList) {
this.clearMessage();
try {
await this.$store.dispatch('sendMessage', {
conversationId: this.currentChat.id,
message: this.message,
message: newMessage,
private: this.isPrivate,
});
this.$emit('scrollToMessage');
} catch (error) {
// Error
}
this.clearMessage();
this.hideEmojiPicker();
}
},

View file

@ -35,3 +35,4 @@ conversation = Conversation.create!(
additional_attributes: {}
)
Message.create!(content: 'Hello', account: account, inbox: inbox, conversation: conversation, message_type: :incoming)
CannedResponse.create!(account: account, short_code: 'start', content: 'Hello welcome to chatwoot.')