Use since_id when pulling the current chat messages

This commit is contained in:
eugenijm 2020-05-30 13:47:46 +03:00
parent fdef990c6a
commit 6c2c0883ce
2 changed files with 10 additions and 6 deletions

View file

@ -91,6 +91,7 @@ const Chat = {
currentUser: state => state.users.currentUser,
isMobileLayout: state => state.interface.mobileLayout,
openedChats: state => state.chats.openedChats,
openedChatMessageServices: state => state.chats.openedChatMessageServices,
windowHeight: state => state.interface.layoutHeight
})
},
@ -263,7 +264,10 @@ const Chat = {
positionBeforeLoading = this.getPosition()
previousScrollTop = this.$refs.scrollable.scrollTop
}
this.backendInteractor.chatMessages({ id: chatId, maxId })
const chatMessageService = this.openedChatMessageServices[chatId]
const sinceId = chatMessageService.lastMessage && chatMessageService.lastMessage.id
this.backendInteractor.chatMessages({ id: chatId, maxId, sinceId })
.then((messages) => {
let bottomedOut = this.bottomedOut()
this.loadingOlderMessages = false

View file

@ -332,11 +332,11 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
dispatch('fetchEmojiReactionsBy', notification.status.id)
}
if (notification.type === 'pleroma:chat_mention') {
dispatch('addChatMessages', { chatId: notification.chatMessage.chat_id, messages: [notification.chatMessage] })
dispatch('updateChatByAccountId', { accountId: notification.from_profile.id })
// dispatch('updateUnreadChatCount', { userId, unreadChatCount })
}
// if (notification.type === 'pleroma:chat_mention') {
// dispatch('addChatMessages', { chatId: notification.chatMessage.chat_id, messages: [notification.chatMessage] })
// dispatch('updateChatByAccountId', { accountId: notification.from_profile.id })
// // dispatch('updateUnreadChatCount', { userId, unreadChatCount })
// }
// Only add a new notification if we don't have one for the same action
if (!state.notifications.idStore.hasOwnProperty(notification.id)) {