4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-11 17:55:51 +00:00
This commit is contained in:
AlphaX-Projects 2023-02-06 11:27:21 +01:00
commit 3d9f730285
2 changed files with 15 additions and 3 deletions

View File

@ -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

View File

@ -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}` }
})