Skip to content

Commit

Permalink
contacts: disable hashtag follows for now
Browse files Browse the repository at this point in the history
People are spamming hashtags with AI CP. Let's disable this until we
at least have image blurring.

Alternatively we could only show the link for people you don't follow.

Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Jan 27, 2025
1 parent d0265a5 commit 478603e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions crates/notedeck/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ impl FilteredTags {

/// Create a filter from tags. This can be used to create a filter
/// from a contact list
pub fn filter_from_tags(note: &Note, add_pubkey: Option<&[u8; 32]>) -> Result<FilteredTags> {
pub fn filter_from_tags(
note: &Note,
add_pubkey: Option<&[u8; 32]>,
with_hashtags: bool,
) -> Result<FilteredTags> {
let mut author_filter = Filter::new();
let mut hashtag_filter = Filter::new();
let mut author_res: Option<FilterBuilder> = None;
Expand Down Expand Up @@ -233,7 +237,7 @@ pub fn filter_from_tags(note: &Note, add_pubkey: Option<&[u8; 32]>) -> Result<Fi

author_filter.add_id_element(author)?;
author_count += 1;
} else if t == "t" {
} else if t == "t" && with_hashtags {
let hashtag = if let Some(hashtag) = tag.get_unchecked(1).variant().str() {
hashtag
} else {
Expand Down
7 changes: 5 additions & 2 deletions crates/notedeck_columns/src/timeline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ impl Timeline {
deck_author: Option<&[u8; 32]>,
) -> Result<Self> {
let our_pubkey = deck_author.map(|da| pk_src.to_pubkey_bytes(da));
let filter = filter::filter_from_tags(contact_list, our_pubkey)?.into_follow_filter();
let with_hashtags = false;
let filter =
filter::filter_from_tags(contact_list, our_pubkey, with_hashtags)?.into_follow_filter();

Ok(Timeline::new(
TimelineKind::contact_list(pk_src),
Expand Down Expand Up @@ -689,6 +691,7 @@ pub fn is_timeline_ready(
info!("notes found for contact timeline after GotRemote!");

let note_key = res[0];
let with_hashtags = false;

let filter = {
let txn = Transaction::new(ndb).expect("txn");
Expand All @@ -698,7 +701,7 @@ pub fn is_timeline_ready(
.pubkey_source()
.as_ref()
.and_then(|pk_src| our_pk.map(|pk| pk_src.to_pubkey_bytes(pk)));
filter::filter_from_tags(&note, add_pk).map(|f| f.into_follow_filter())
filter::filter_from_tags(&note, add_pk, with_hashtags).map(|f| f.into_follow_filter())
};

// TODO: into_follow_filter is hardcoded to contact lists, let's generalize
Expand Down

0 comments on commit 478603e

Please sign in to comment.