eventMatchesTemplate: let the event timestamp be greater than the template

This commit is contained in:
Alex Gleason 2023-11-20 21:20:14 -06:00
parent e55ddbd8e6
commit 595fb2cfc6
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 9 additions and 1 deletions

View File

@ -123,7 +123,15 @@ function eventMatchesTemplate(event: Event, template: EventTemplate): boolean {
event = stripTags(event, whitelist); event = stripTags(event, whitelist);
template = stripTags(template, whitelist); template = stripTags(template, whitelist);
return getEventHash(event) === getEventHash({ pubkey: event.pubkey, ...template }); if (template.created_at > event.created_at) {
return false;
}
return getEventHash(event) === getEventHash({
pubkey: event.pubkey,
...template,
created_at: event.created_at,
});
} }
/** Test whether the value is a Nostr ID. */ /** Test whether the value is a Nostr ID. */