From 595fb2cfc614da79c2b3e5bd51239e7b318a1fc0 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 20 Nov 2023 21:20:14 -0600 Subject: [PATCH] eventMatchesTemplate: let the event timestamp be greater than the template --- src/utils.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index 2b258fc..1f10cd3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -123,7 +123,15 @@ function eventMatchesTemplate(event: Event, template: EventTemplate): boolean { event = stripTags(event, 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. */