Skip to content

Commit

Permalink
When non-lowercase hashtags are specified, add an additional lowercas…
Browse files Browse the repository at this point in the history
…e version to the event
  • Loading branch information
mikedilger committed Dec 30, 2024
1 parent 1826126 commit 10746c9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion gossip-lib/src/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,15 @@ async fn add_tags_mirroring_content(content: &str, tags: &mut Vec<Tag>, direct_m

// Find and tag all hashtags
for capture in GLOBALS.hashtag_regex.captures_iter(content) {
tags.push(Tag::new_hashtag(capture[1][1..].to_string()));
let hashtag = capture[1][1..].to_string();
let hashtag_lower = hashtag.to_lowercase();

if hashtag == hashtag_lower {
tags.push(Tag::new_hashtag(hashtag));
} else {
tags.push(Tag::new_hashtag(hashtag));
tags.push(Tag::new_hashtag(hashtag_lower));
}
}
}

Expand Down

0 comments on commit 10746c9

Please sign in to comment.