mirror of
https://github.com/nostrlabs-io/notepush.git
synced 2025-06-15 11:28:23 +00:00
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:

committed by
Daniel D’Aquino

parent
11ee57f0bb
commit
e73f5ce70e
@ -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(());
|
||||
|
Reference in New Issue
Block a user