Browse Source

fix unread error in general chat

q-apps
Phillip 2 years ago
parent
commit
8bf10588b9
  1. 16
      qortal-ui-plugins/plugins/core/components/ChatPage.js
  2. 2
      qortal-ui-plugins/plugins/core/messaging/q-chat/q-chat.src.js

16
qortal-ui-plugins/plugins/core/components/ChatPage.js

@ -1421,6 +1421,12 @@ class ChatPage extends LitElement {
})
document.addEventListener('keydown', this.initialChat);
document.addEventListener('paste', this.pasteImage);
if(this.chatId){
window.parent.reduxStore.dispatch( window.parent.reduxAction.addChatLastSeen({
key: this.chatId,
timestamp: Date.now()
}))
}
}
disconnectedCallback() {
@ -1444,7 +1450,7 @@ class ChatPage extends LitElement {
document.removeEventListener('keydown', this.initialChat);
document.removeEventListener('paste', this.pasteImage);
if(this.messagesRendered.length !== 0){
if(this.chatId){
window.parent.reduxStore.dispatch( window.parent.reduxAction.addChatLastSeen({
key: this.chatId,
timestamp: Date.now()
@ -2181,7 +2187,13 @@ class ChatPage extends LitElement {
await this.renderNewMessage(msg)
})
await Promise.all(renderEachMessage)
if(this.chatId){
window.parent.reduxStore.dispatch( window.parent.reduxAction.addChatLastSeen({
key: this.chatId,
timestamp: Date.now()
}))
}
// this.newMessages = this.newMessages.concat(_newMessages)
this.messagesRendered = [...this.messagesRendered].sort(function (a, b) {
return a.timestamp

2
qortal-ui-plugins/plugins/core/messaging/q-chat/q-chat.src.js

@ -887,7 +887,7 @@ class Chat extends LitElement {
setChatHeads(chatObj) {
const chatObjGroups = Array.isArray(chatObj.groups) ? chatObj.groups : [];
const chatObjDirect = Array.isArray(chatObj.direct) ? chatObj.direct : [];
let groupList = chatObjGroups.map(group => group.groupId === 0 ? { groupId: group.groupId, url: `group/${group.groupId}`, groupName: "Qortal General Chat", timestamp: group.timestamp === undefined ? 2 : group.timestamp } : { ...group, timestamp: group.timestamp === undefined ? 1 : group.timestamp, url: `group/${group.groupId}` })
let groupList = chatObjGroups.map(group => group.groupId === 0 ? { groupId: group.groupId, url: `group/${group.groupId}`, groupName: "Qortal General Chat", timestamp: group.timestamp === undefined ? 2 : group.timestamp, sender: group.sender } : { ...group, timestamp: group.timestamp === undefined ? 1 : group.timestamp, url: `group/${group.groupId}` })
let directList = chatObjDirect.map(dc => {
return { ...dc, url: `direct/${dc.address}` }
})

Loading…
Cancel
Save