aboutsummaryrefslogtreecommitdiff
path: root/src/components/chat/chat.js
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2020-10-01 12:54:54 +0000
committerShpuld Shpludson <shp@cock.li>2020-10-01 12:54:54 +0000
commit8a34ff2957e28f7531c62c793ea4f24558e08ced (patch)
treea631749e1fe647085d2ea328b5840b56b344b04e /src/components/chat/chat.js
parentfa9176651952468ee996abe0e67d62d9a72d5a69 (diff)
parent68c2a5b18f887f3db2f5685953bc5175aaaabbd3 (diff)
Merge branch 'develop' into 'feat/masto-ws-deletes'
# Conflicts: # CHANGELOG.md # src/components/status/status.js # src/components/status/status.scss
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