commit 49fd5d2be1249a8adef8f5b37a6fd10df6af3bf0
parent c2ee6bfe353c42500d228aec9317aad0b1cedb28
Author: alltheseas <alltheseas@users.noreply.github.com>
Date: Mon, 10 Nov 2025 21:46:00 -0600
Add UI control for max hashtags per note setting
Add a user-facing slider control in the Settings panel to configure
the maximum number of hashtags allowed per note before filtering.
Changes to settings.rs:
- Add SetMaxHashtagsPerNote variant to SettingsAction enum
- Add accounts parameter to process_settings_action() signature
- Call accounts.update_max_hashtags_per_note() when setting changes
- Add slider control (range 0-20) in other_options_section
- Add reset button to restore default value (3)
- Add help text showing current filter status
- Import DEFAULT_MAX_HASHTAGS_PER_NOTE constant
Changes to nav.rs:
- Pass ctx.accounts to process_settings_action() call
- Update formatting for better readability
The slider allows users to:
- Set 0 to disable filtering entirely
- Set 1-20 to hide posts exceeding that hashtag count
- Click Reset to restore the default value of 3
The setting updates immediately and persists across sessions.
Changes are propagated to all account mute filters in real-time.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
2 files changed, 68 insertions(+), 4 deletions(-)
diff --git a/crates/notedeck_columns/src/nav.rs b/crates/notedeck_columns/src/nav.rs
@@ -527,9 +527,14 @@ fn process_render_nav_action(
.process_relay_action(ui.ctx(), ctx.pool, action);
None
}
- RenderNavAction::SettingsAction(action) => {
- action.process_settings_action(app, ctx.settings, ctx.i18n, ctx.img_cache, ui.ctx())
- }
+ RenderNavAction::SettingsAction(action) => action.process_settings_action(
+ app,
+ ctx.settings,
+ ctx.i18n,
+ ctx.img_cache,
+ ui.ctx(),
+ ctx.accounts,
+ ),
RenderNavAction::RepostAction(action) => {
action.process(ctx.ndb, &ctx.accounts.get_selected_account().key, ctx.pool)
}
diff --git a/crates/notedeck_columns/src/ui/settings.rs b/crates/notedeck_columns/src/ui/settings.rs
@@ -9,7 +9,7 @@ use notedeck::{
tr,
ui::{is_narrow, richtext_small},
Images, JobsCache, LanguageIdentifier, Localization, NoteContext, NotedeckTextStyle, Settings,
- SettingsHandler, DEFAULT_NOTE_BODY_FONT_SIZE,
+ SettingsHandler, DEFAULT_MAX_HASHTAGS_PER_NOTE, DEFAULT_NOTE_BODY_FONT_SIZE,
};
use notedeck_ui::{
app_images::{copy_to_clipboard_dark_image, copy_to_clipboard_image},
@@ -35,6 +35,7 @@ pub enum SettingsAction {
SetLocale(LanguageIdentifier),
SetRepliestNewestFirst(bool),
SetNoteBodyFontSize(f32),
+ SetMaxHashtagsPerNote(usize),
OpenRelays,
OpenCacheFolder,
ClearCacheFolder,
@@ -48,6 +49,7 @@ impl SettingsAction {
i18n: &'a mut Localization,
img_cache: &mut Images,
ctx: &egui::Context,
+ accounts: &mut notedeck::Accounts,
) -> Option<RouterAction> {
let mut route_action: Option<RouterAction> = None;
@@ -89,6 +91,10 @@ impl SettingsAction {
settings.set_note_body_font_size(size);
}
+ Self::SetMaxHashtagsPerNote(value) => {
+ settings.set_max_hashtags_per_note(value);
+ accounts.update_max_hashtags_per_note(value);
+ }
}
route_action
}
@@ -474,6 +480,59 @@ impl<'a> SettingsView<'a> {
));
}
});
+
+ ui.horizontal_wrapped(|ui| {
+ ui.label(richtext_small(tr!(
+ self.note_context.i18n,
+ "Max hashtags per note:",
+ "Label for max hashtags per note, others settings section",
+ )));
+
+ if ui
+ .add(
+ egui::Slider::new(&mut self.settings.max_hashtags_per_note, 0..=20)
+ .text("")
+ .step_by(1.0),
+ )
+ .changed()
+ {
+ action = Some(SettingsAction::SetMaxHashtagsPerNote(
+ self.settings.max_hashtags_per_note,
+ ));
+ };
+
+ if ui
+ .button(richtext_small(tr!(
+ self.note_context.i18n,
+ "Reset",
+ "Label for reset max hashtags per note, others settings section",
+ )))
+ .clicked()
+ {
+ action = Some(SettingsAction::SetMaxHashtagsPerNote(
+ DEFAULT_MAX_HASHTAGS_PER_NOTE,
+ ));
+ }
+ });
+
+ ui.horizontal_wrapped(|ui| {
+ let text = if self.settings.max_hashtags_per_note == 0 {
+ tr!(
+ self.note_context.i18n,
+ "Hashtag filter disabled",
+ "Info text when hashtag filter is disabled (set to 0)"
+ )
+ } else {
+ format!(
+ "Hide posts with more than {} hashtags",
+ self.settings.max_hashtags_per_note
+ )
+ };
+ ui.label(
+ richtext_small(&text)
+ .color(ui.visuals().gray_out(ui.visuals().text_color())),
+ );
+ });
});
action