aboutsummaryrefslogtreecommitdiff
path: root/src/components/chat/chat.js
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2020-09-18 22:04:01 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2020-09-18 22:04:01 +0300
commit3dbc1bedbf7ea7f168548d0766d095dba02a741a (patch)
treeb7dd60bda705acd87adbff194f0263e0f49973c2 /src/components/chat/chat.js
parent947d7cd6f285c7c683b92f79d9d2c08dd2131f5d (diff)
parentb725df6352c27421f0549b6e4c2ceeb0d240919f (diff)
Merge branch 'develop' into feature/import_export_mutes
Diffstat (limited to 'src/components/chat/chat.js')
-rw-r--r--src/components/chat/chat.js12
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