invert the filtering for our purposes

This commit is contained in:
sakrecoer 2026-05-26 21:06:35 +02:00
parent 4d4d9d62d0
commit 713aa404c7

View file

@ -11,12 +11,12 @@ pub struct Kinds {
impl NoteFilter for Kinds {
fn filter_note(&mut self, input: &InputMessage) -> OutputMessage {
let kind = input.event.kind;
if self.kinds.contains(&kind) {
if !self.kinds.contains(&kind) {
let msg = self
.messages
.as_ref()
.and_then(|msgs| msgs.get(&kind.to_string()).cloned())
.unwrap_or_else(|| "blocked: note kind is not allowed here".to_string());
.unwrap_or_else(|| "blocked: this relay only accept music and playlist events (kind 36787 and 34139)".to_string());
OutputMessage::new(input.event.id.clone(), Action::Reject, Some(msg))
} else {
OutputMessage::new(input.event.id.clone(), Action::Accept, None)