From ac02d5ac73169800e4ad169efbdfc9bc95ffa67e Mon Sep 17 00:00:00 2001 From: Edgard Date: Sat, 18 Jun 2022 18:26:56 -0300 Subject: [PATCH] fix: Fixed the return for WPP.contact.getStatus function --- src/contact/functions/getStatus.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/contact/functions/getStatus.ts b/src/contact/functions/getStatus.ts index 252f7d71a2..06c2471fa3 100644 --- a/src/contact/functions/getStatus.ts +++ b/src/contact/functions/getStatus.ts @@ -16,6 +16,7 @@ import { assertWid } from '../../assert'; import { StatusStore, Wid } from '../../whatsapp'; +import { queryExists } from './queryExists'; /** * Get the current text status @@ -31,5 +32,13 @@ import { StatusStore, Wid } from '../../whatsapp'; export async function getStatus(contactId: string | Wid) { const wid = assertWid(contactId); - return StatusStore.find(wid); + const exists = await queryExists(wid); + + if (!exists) { + return null; + } + + const model = await StatusStore.find(wid); + + return model.status || null; }