add unknown chats modal

This commit is contained in:
Ren Amamiya
2023-07-25 16:12:52 +07:00
parent 1362dfadda
commit a4e03a59eb
4 changed files with 139 additions and 27 deletions

View File

@@ -308,9 +308,9 @@ export async function getChats() {
const follows =
typeof account.follows === 'string' ? JSON.parse(account.follows) : account.follows;
const chats: { follows: Array<Chats> | null; unknown: number } = {
const chats: { follows: Array<Chats> | null; unknowns: Array<Chats> | null } = {
follows: [],
unknown: 0,
unknowns: [],
};
let result: Array<Chats> = await db.select(
@@ -326,7 +326,9 @@ export async function getChats() {
});
});
chats.unknown = result.length - chats.follows.length;
chats.unknowns = result.filter(
(el) => !chats.follows.includes(el) && el.sender_pubkey !== account.pubkey
);
return chats;
}