Do not send notifications for future notes

Changelog-Fixed: Do not send notifications for future notes

Closes: https://github.com/damus-io/damus/issues/2949
Signed-off-by: Terry Yiu <git@tyiu.xyz>
This commit is contained in:
Terry Yiu
2025-04-11 13:55:45 -04:00
committed by Daniel D’Aquino
parent 11ee57f0bb
commit e73f5ce70e

View File

@ -345,6 +345,13 @@ impl NotificationManager {
return Ok(());
}
// Allow notes that are created no more than 3 seconds in the future
// to account for natural clock skew between sender and receiver.
if event.created_at > Timestamp::now() + 3 {
log::debug!("Event was scheduled for the future, not sending notifications");
return Ok(());
}
if !Self::is_event_kind_supported(event.kind) {
log::debug!("Event kind is not supported, not sending notifications");
return Ok(());