bug fixes

This commit is contained in:
2023-10-21 14:25:12 +03:00
parent d0507946aa
commit 547671cc35
9 changed files with 659 additions and 385 deletions

View File

@@ -1199,6 +1199,11 @@ class ChatPage extends LitElement {
}, 2000)
}
const chatScrollerElement = this.shadowRoot.querySelector('chat-scroller');
if (chatScrollerElement && chatScrollerElement.disableFetching) {
chatScrollerElement.disableFetching = false
}
return
}
this.isLoadingGoToRepliedMessage = {
@@ -1668,12 +1673,20 @@ class ChatPage extends LitElement {
}
})
this.messagesRendered = {
messages: list,
type: 'inBetween',
message: messageToGoTo
}
const lastMsg = list.at(-1)
if(lastMsg){
const count = await parentEpml.request('apiCall', {
type: 'api',
url: `/chat/messages/count?after=${lastMsg.timestamp}&involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${this._chatId}&limit=20&reverse=false`
})
this.messagesRendered = {
messages: list,
type: 'inBetween',
message: messageToGoTo,
count
}
}
this.isLoadingOldMessages = false
@@ -1727,11 +1740,20 @@ class ChatPage extends LitElement {
}
})
this.messagesRendered = {
messages: list,
type: 'inBetween',
signature: messageToGoTo.signature
}
const lastMsg = list.at(-1)
if(lastMsg){
const count = await parentEpml.request('apiCall', {
type: 'api',
url: `/chat/messages/count?after=${lastMsg.timestamp}&txGroupId=${Number(this._chatId)}&limit=20&reverse=false`
})
this.messagesRendered = {
messages: list,
type: 'inBetween',
signature: messageToGoTo.signature,
count
}
}
this.isLoadingOldMessages = false

View File

@@ -345,7 +345,7 @@ class ChatScroller extends LitElement {
this.requestUpdate();
}
async newListMessages(newMessages) {
async newListMessages(newMessages, count) {
let data = [];
const copy = [...newMessages];
copy.forEach((newMessage) => {
@@ -368,6 +368,9 @@ class ChatScroller extends LitElement {
// url: `/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${this._chatId}&limit=${chatLimit}&reverse=true&before=${scrollElement.messageObj.timestamp}&haschatreference=false&encoding=BASE64`
// })
this.messagesToRender = data;
if (count > 0) {
this.disableAddingNewMessages = true;
}
this.clearLoaders();
this.requestUpdate();
await this.updateComplete;
@@ -645,7 +648,7 @@ class ChatScroller extends LitElement {
else if (this.messages.type === 'inBetween')
this.newListMessages(
this.messages.messages,
this.messages.signature
this.messages.count
);
else if (this.messages.type === 'update')
this.replaceMessagesWithUpdateByArray(this.messages.messages);