mutes: simplify mutefun and don't render tombstone yet

This commit is contained in:
William Casarin
2025-01-04 16:19:41 -08:00
parent c7d3aae856
commit e08e30f912
3 changed files with 17 additions and 24 deletions

View File

@@ -421,7 +421,7 @@ impl Accounts {
}
}
}
Box::new(|_: &Note, _: &[u8; 32]| None)
Box::new(|_: &Note, _: &[u8; 32]| false)
}
pub fn send_initial_filters(&mut self, pool: &mut RelayPool, relay_url: &str) {

View File

@@ -4,7 +4,7 @@ use std::collections::BTreeSet;
use tracing::{debug, trace};
// If the note is muted return a reason string, otherwise None
pub type MuteFun = dyn Fn(&Note, &[u8; 32]) -> Option<String>;
pub type MuteFun = dyn Fn(&Note, &[u8; 32]) -> bool;
#[derive(Default)]
pub struct Muted {
@@ -34,7 +34,7 @@ impl std::fmt::Debug for Muted {
impl Muted {
// If the note is muted return a reason string, otherwise None
pub fn is_muted(&self, note: &Note, thread: &[u8; 32]) -> Option<String> {
pub fn is_muted(&self, note: &Note, thread: &[u8; 32]) -> bool {
trace!(
"{}: thread: {}",
hex::encode(note.id()),
@@ -47,7 +47,7 @@ impl Muted {
hex::encode(note.id()),
hex::encode(note.pubkey())
);
return Some(format!("pubkey {}", hex::encode(note.pubkey())));
return true;
}
// FIXME - Implement hashtag muting here
@@ -69,10 +69,9 @@ impl Muted {
hex::encode(note.id()),
hex::encode(thread)
);
return Some(format!("thread {}", hex::encode(thread)));
return true;
}
// if we get here it's not muted
None
false
}
}