diff options
| author | Shpuld Shpludson <shp@cock.li> | 2020-09-16 07:13:31 +0000 |
|---|---|---|
| committer | Shpuld Shpludson <shp@cock.li> | 2020-09-16 07:13:31 +0000 |
| commit | 38189ee838927c8829efe50c2687c61ff95444b9 (patch) | |
| tree | 8ddb34abe8d9e462f31f471e1bafb40a51a19c03 /src/components/chat/chat.js | |
| parent | c00c20a31fc2c14d64ebaad9b34e8c3307501073 (diff) | |
| parent | 8c4514013d5a53218830a82a6ac46f5969edd69b (diff) | |
Merge branch 'fix-chat-message-list-fetch' into 'develop'
Fix chat messages being missed sometimes when the streaming is disabled and the messages are sent by both participants simultaneously
Closes #957
See merge request pleroma/pleroma-fe!1233
Diffstat (limited to 'src/components/chat/chat.js')
| -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 9c4e5b05..803abf69 100644 --- a/src/components/chat/chat.js +++ b/src/components/chat/chat.js @@ -204,9 +204,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) { @@ -244,7 +244,7 @@ const Chat = { const chatId = chatMessageService.chatId const fetchOlderMessages = !!maxId - const sinceId = fetchLatest && chatMessageService.lastMessage && chatMessageService.lastMessage.id + const sinceId = fetchLatest && chatMessageService.maxId this.backendInteractor.chatMessages({ id: chatId, maxId, sinceId }) .then((messages) => { @@ -303,7 +303,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 |
