commit 9fa47305950e2edef0f199db2f8d6bedbd71e35d
parent eac5d41e3cb1587c65d1fe29cbc23df0ec302ed5
Author: alltheseas <alltheseas@users.noreply.github.com>
Date: Mon, 10 Nov 2025 21:37:11 -0600
Add configurable max hashtags per note setting
Add a new user-configurable setting to control the maximum number of
hashtags allowed per note before filtering. Default value is 3.
Changes:
- Add max_hashtags_per_note field to Settings struct
- Add DEFAULT_MAX_HASHTAGS_PER_NOTE constant (default: 3)
- Add getter and setter methods in SettingsHandler
- Export DEFAULT_MAX_HASHTAGS_PER_NOTE from persist module
This setting will be used by the filtering logic to hide notes
with excessive hashtags, helping reduce spam in the timeline.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/crates/notedeck/src/persist/mod.rs b/crates/notedeck/src/persist/mod.rs
@@ -6,4 +6,5 @@ pub use app_size::AppSizeHandler;
pub use settings_handler::Settings;
pub use settings_handler::SettingsHandler;
pub use settings_handler::DEFAULT_NOTE_BODY_FONT_SIZE;
+pub use settings_handler::DEFAULT_MAX_HASHTAGS_PER_NOTE;
pub use token_handler::TokenHandler;
diff --git a/crates/notedeck/src/persist/settings_handler.rs b/crates/notedeck/src/persist/settings_handler.rs
@@ -18,6 +18,7 @@ const DEFAULT_SHOW_REPLIES_NEWEST_FIRST: bool = false;
pub const DEFAULT_NOTE_BODY_FONT_SIZE: f32 = 13.0;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub const DEFAULT_NOTE_BODY_FONT_SIZE: f32 = 16.0;
+pub const DEFAULT_MAX_HASHTAGS_PER_NOTE: usize = 3;
fn deserialize_theme(serialized_theme: &str) -> Option<ThemePreference> {
match serialized_theme {
@@ -36,6 +37,7 @@ pub struct Settings {
pub show_source_client: String,
pub show_replies_newest_first: bool,
pub note_body_font_size: f32,
+ pub max_hashtags_per_note: usize,
}
impl Default for Settings {
@@ -47,6 +49,7 @@ impl Default for Settings {
show_source_client: DEFAULT_SHOW_SOURCE_CLIENT.to_string(),
show_replies_newest_first: DEFAULT_SHOW_REPLIES_NEWEST_FIRST,
note_body_font_size: DEFAULT_NOTE_BODY_FONT_SIZE,
+ max_hashtags_per_note: DEFAULT_MAX_HASHTAGS_PER_NOTE,
}
}
}
@@ -191,6 +194,11 @@ impl SettingsHandler {
self.try_save_settings();
}
+ pub fn set_max_hashtags_per_note(&mut self, value: usize) {
+ self.get_settings_mut().max_hashtags_per_note = value;
+ self.try_save_settings();
+ }
+
pub fn update_batch<F>(&mut self, update_fn: F)
where
F: FnOnce(&mut Settings),
@@ -250,4 +258,11 @@ impl SettingsHandler {
.map(|s| s.note_body_font_size)
.unwrap_or(DEFAULT_NOTE_BODY_FONT_SIZE)
}
+
+ pub fn max_hashtags_per_note(&self) -> usize {
+ self.current_settings
+ .as_ref()
+ .map(|s| s.max_hashtags_per_note)
+ .unwrap_or(DEFAULT_MAX_HASHTAGS_PER_NOTE)
+ }
}