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
This commit is contained in:
commit
38189ee838
4 changed files with 26 additions and 33 deletions
|
@ -182,30 +182,16 @@ const chats = {
|
|||
setChatsLoading (state, { value }) {
|
||||
state.chats.loading = value
|
||||
},
|
||||
addChatMessages (state, { commit, chatId, messages }) {
|
||||
addChatMessages (state, { chatId, messages, updateMaxId }) {
|
||||
const chatMessageService = state.openedChatMessageServices[chatId]
|
||||
if (chatMessageService) {
|
||||
chatService.add(chatMessageService, { messages: messages.map(parseChatMessage) })
|
||||
commit('refreshLastMessage', { chatId })
|
||||
chatService.add(chatMessageService, { messages: messages.map(parseChatMessage), updateMaxId })
|
||||
}
|
||||
},
|
||||
refreshLastMessage (state, { chatId }) {
|
||||
const chatMessageService = state.openedChatMessageServices[chatId]
|
||||
if (chatMessageService) {
|
||||
const chat = getChatById(state, chatId)
|
||||
if (chat) {
|
||||
chat.lastMessage = chatMessageService.lastMessage
|
||||
if (chatMessageService.lastMessage) {
|
||||
chat.updated_at = chatMessageService.lastMessage.created_at
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
deleteChatMessage (state, { commit, chatId, messageId }) {
|
||||
deleteChatMessage (state, { chatId, messageId }) {
|
||||
const chatMessageService = state.openedChatMessageServices[chatId]
|
||||
if (chatMessageService) {
|
||||
chatService.deleteMessage(chatMessageService, messageId)
|
||||
commit('refreshLastMessage', { chatId })
|
||||
}
|
||||
},
|
||||
resetChatNewMessageCount (state, _value) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue