[core] NOWEB disappearing messages

fix #736
This commit is contained in:
devlikepro committed 2025-03-16 14:05:25 +07:00
1 parent 4d8aad9dfe
commit cb5781ca65
4 files changed
+15 -2

No files matched your search

+5 -2
View File
@@ -2066,14 +2066,17 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
}
protected async getMessageOptions(request: any): Promise<any> {
const jid = toJID(request.chatId);
let quoted;
if (request.reply_to) {
const key = parseMessageIdSerialized(request.reply_to, true);
quoted = await this.store.loadMessage(toJID(request.chatId), key.id);
quoted = await this.store.loadMessage(jid, key.id);
}
const chat = await this.store.getChat(jid);
return {
quoted: quoted,
ephemeralExpiration: chat?.ephemeralExpiration,
};
}
@@ -30,6 +30,8 @@ export interface INowebStore {
getChats(pagination: PaginationParams, broadcast: boolean): Promise<Chat[]>;
getChat(jid: string): Promise<Chat | null>;
getContacts(pagination: PaginationParams): Promise<Contact[]>;
getContactById(jid: string): Promise<Contact>;
@@ -65,6 +65,10 @@ export class NowebInMemoryStore implements INowebStore {
throw new BadRequestException(this.errorMessage);
}
getChat(jid: string): Promise<Chat | null> {
return null;
}
getContacts(pagination: PaginationParams): Promise<Contact[]> {
throw new BadRequestException(this.errorMessage);
}
@@ -462,6 +462,10 @@ export class NowebPersistentStore implements INowebStore {
return this.chatRepo.getAllWithMessages(pagination, broadcast);
}
async getChat(jid: string): Promise<Chat | null> {
return await this.chatRepo.getById(jid);
}
private shouldFetchGroup(): boolean {
const timePassed = new Date().getTime() - this.lastTimeGroupFetch.getTime();
return timePassed > this.GROUP_METADATA_CACHE_TIME;