fix: chat instance retrieving in syncHistory (#3342)

This commit is contained in:
alechkos 2025-05-30 15:53:36 +03:00 • committed by GitHub
commit 385e3cc59b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1762,8 +1762,9 @@ class Client extends EventEmitter {
*/
async syncHistory(chatId) {
return await this.pupPage.evaluate(async (chatId) => {
const chat = await window.WWebJS.getChat(chatId);
if (chat.endOfHistoryTransferType === 0) {
const chatWid = window.Store.WidFactory.createWid(chatId);
const chat = window.Store.Chat.get(chatWid) ?? (await window.Store.Chat.find(chatWid));
if (chat?.endOfHistoryTransferType === 0) {
await window.Store.HistorySync.sendPeerDataOperationRequest(3, {
chatId: chat.id
});