bug: use latest profile

This commit is contained in:
Kieran 2023-01-17 14:17:41 +00:00
parent dda07d66d5
commit 715594986b
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
1 changed files with 4 additions and 1 deletions

View File

@ -178,9 +178,12 @@ export class NostrSystem {
sub.OnEvent = async (e) => {
let profile = mapEventToProfile(e);
if (profile) {
let existing = await db.users.get(profile.pubkey);
if((existing?.created ?? 0) < profile.created) {
await db.users.put(profile);
}
}
}
let results = await this.RequestSubscription(sub);
let couldNotFetch = Array.from(missing).filter(a => !results.some(b => b.pubkey === a));
console.debug("No profiles: ", couldNotFetch);