diff --git a/src/core/engines/noweb/session.noweb.core.ts b/src/core/engines/noweb/session.noweb.core.ts index 678fae78..abe6d052 100644 --- a/src/core/engines/noweb/session.noweb.core.ts +++ b/src/core/engines/noweb/session.noweb.core.ts @@ -2066,14 +2066,17 @@ export class WhatsappSessionNoWebCore extends WhatsappSession { } protected async getMessageOptions(request: any): Promise { + 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, }; } diff --git a/src/core/engines/noweb/store/INowebStore.ts b/src/core/engines/noweb/store/INowebStore.ts index 3df53b4a..b8616293 100644 --- a/src/core/engines/noweb/store/INowebStore.ts +++ b/src/core/engines/noweb/store/INowebStore.ts @@ -30,6 +30,8 @@ export interface INowebStore { getChats(pagination: PaginationParams, broadcast: boolean): Promise; + getChat(jid: string): Promise; + getContacts(pagination: PaginationParams): Promise; getContactById(jid: string): Promise; diff --git a/src/core/engines/noweb/store/NowebInMemoryStore.ts b/src/core/engines/noweb/store/NowebInMemoryStore.ts index 88dee609..0309edab 100644 --- a/src/core/engines/noweb/store/NowebInMemoryStore.ts +++ b/src/core/engines/noweb/store/NowebInMemoryStore.ts @@ -65,6 +65,10 @@ export class NowebInMemoryStore implements INowebStore { throw new BadRequestException(this.errorMessage); } + getChat(jid: string): Promise { + return null; + } + getContacts(pagination: PaginationParams): Promise { throw new BadRequestException(this.errorMessage); } diff --git a/src/core/engines/noweb/store/NowebPersistentStore.ts b/src/core/engines/noweb/store/NowebPersistentStore.ts index 8dda1214..e89ac218 100644 --- a/src/core/engines/noweb/store/NowebPersistentStore.ts +++ b/src/core/engines/noweb/store/NowebPersistentStore.ts @@ -462,6 +462,10 @@ export class NowebPersistentStore implements INowebStore { return this.chatRepo.getAllWithMessages(pagination, broadcast); } + async getChat(jid: string): Promise { + return await this.chatRepo.getById(jid); + } + private shouldFetchGroup(): boolean { const timePassed = new Date().getTime() - this.lastTimeGroupFetch.getTime(); return timePassed > this.GROUP_METADATA_CACHE_TIME;