diff options
Diffstat (limited to 'src/components/chat')
| -rw-r--r-- | src/components/chat/chat.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/components/chat/chat.js b/src/components/chat/chat.js index 15123885..34e723d0 100644 --- a/src/components/chat/chat.js +++ b/src/components/chat/chat.js @@ -205,9 +205,9 @@ const Chat = { } }, readChat () { - if (!(this.currentChatMessageService && this.currentChatMessageService.lastMessage)) { return } + if (!(this.currentChatMessageService && this.currentChatMessageService.maxId)) { return } if (document.hidden) { return } - const lastReadId = this.currentChatMessageService.lastMessage.id + const lastReadId = this.currentChatMessageService.maxId this.$store.dispatch('readChat', { id: this.currentChat.id, lastReadId }) }, bottomedOut (offset) { @@ -245,7 +245,7 @@ const Chat = { const chatId = chatMessageService.chatId const fetchOlderMessages = !!maxId - const sinceId = fetchLatest && chatMessageService.lastMessage && chatMessageService.lastMessage.id + const sinceId = fetchLatest && chatMessageService.maxId return this.backendInteractor.chatMessages({ id: chatId, maxId, sinceId }) .then((messages) => { @@ -304,7 +304,11 @@ const Chat = { return this.backendInteractor.sendChatMessage(params) .then(data => { - this.$store.dispatch('addChatMessages', { chatId: this.currentChat.id, messages: [data] }).then(() => { + this.$store.dispatch('addChatMessages', { + chatId: this.currentChat.id, + messages: [data], + updateMaxId: false + }).then(() => { this.$nextTick(() => { this.handleResize() // When the posting form size changes because of a media attachment, we need an extra resize |
