mirror of
https://github.com/nostrlabs-io/notepush.git
synced 2025-06-17 12:18:51 +00:00
Do not send notifications about unsupported nostr event kinds
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
@ -139,6 +139,11 @@ impl NotificationManager {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !Self::is_event_kind_supported(event.kind) {
|
||||||
|
log::debug!("Event kind is not supported, not sending notifications");
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let pubkeys_to_notify = self.pubkeys_to_notify_for_event(event).await?;
|
let pubkeys_to_notify = self.pubkeys_to_notify_for_event(event).await?;
|
||||||
|
|
||||||
log::debug!(
|
log::debug!(
|
||||||
@ -167,6 +172,20 @@ impl NotificationManager {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_event_kind_supported(event_kind: nostr::Kind) -> bool {
|
||||||
|
match event_kind {
|
||||||
|
nostr_sdk::Kind::TextNote => true,
|
||||||
|
nostr_sdk::Kind::EncryptedDirectMessage => true,
|
||||||
|
nostr_sdk::Kind::Repost => true,
|
||||||
|
nostr_sdk::Kind::GenericRepost => true,
|
||||||
|
nostr_sdk::Kind::Reaction => true,
|
||||||
|
nostr_sdk::Kind::ZapPrivateMessage => true,
|
||||||
|
nostr_sdk::Kind::ZapRequest => false,
|
||||||
|
nostr_sdk::Kind::ZapReceipt => true,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async fn pubkeys_to_notify_for_event(
|
async fn pubkeys_to_notify_for_event(
|
||||||
&self,
|
&self,
|
||||||
event: &Event,
|
event: &Event,
|
||||||
|
Reference in New Issue
Block a user