Option to hide mutes entirely (was the default) or show them with no content (new default)

This commit is contained in:
Mike Dilger 2023-10-10 09:24:47 +13:00
parent 74d29374cd
commit 6e82cac3d0
4 changed files with 20 additions and 1 deletions

View File

@ -68,7 +68,7 @@ pub(super) fn render_note(
// FIXME drop the cached notes on recompute // FIXME drop the cached notes on recompute
if let Ok(note_data) = note_ref.try_borrow() { if let Ok(note_data) = note_ref.try_borrow() {
let skip = (note_data.muted() let skip = ((note_data.muted() && app.settings.hide_mutes_entirely)
&& !matches!(app.page, Page::Feed(FeedKind::DmChat(_))) && !matches!(app.page, Page::Feed(FeedKind::DmChat(_)))
&& !matches!(app.page, Page::Feed(FeedKind::Person(_)))) && !matches!(app.page, Page::Feed(FeedKind::Person(_))))
|| (note_data.deletion.is_some() && !app.settings.show_deleted_events); || (note_data.deletion.is_some() && !app.settings.show_deleted_events);
@ -995,6 +995,13 @@ fn render_content(
ui.horizontal_wrapped(|ui| { ui.horizontal_wrapped(|ui| {
if app.render_raw == Some(event.id) { if app.render_raw == Some(event.id) {
ui.label(serde_json::to_string_pretty(&event).unwrap()); ui.label(serde_json::to_string_pretty(&event).unwrap());
} else if note.muted() {
let color = app.theme.notice_marker_text_color();
ui.label(
RichText::new("MUTED")
.color(color)
.text_style(TextStyle::Small),
);
} else if app.render_qr == Some(event.id) { } else if app.render_qr == Some(event.id) {
app.render_qr(ui, ctx, "feedqr", event.content.trim()); app.render_qr(ui, ctx, "feedqr", event.content.trim());
// FIXME should this be the unmodified content (event.content)? // FIXME should this be the unmodified content (event.content)?

View File

@ -71,6 +71,13 @@ pub(super) fn update(app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Fr
ui.checkbox(&mut app.settings.show_media, "Render all media inline automatically").on_hover_text("If off, you have to click to (potentially fetch and) render media inline. If on, all media referenced by posts in your feed will be (potentially fetched and) rendered. However, if Fetch Media is disabled, only cached media can be shown as media will not be fetched."); ui.checkbox(&mut app.settings.show_media, "Render all media inline automatically").on_hover_text("If off, you have to click to (potentially fetch and) render media inline. If on, all media referenced by posts in your feed will be (potentially fetched and) rendered. However, if Fetch Media is disabled, only cached media can be shown as media will not be fetched.");
ui.checkbox(&mut app.settings.approve_content_warning, "Approve all content-warning tagged media automatically") ui.checkbox(&mut app.settings.approve_content_warning, "Approve all content-warning tagged media automatically")
.on_hover_text("If off, you have to click to show content-warning tagged media. If on, all content-warning tagged media in your feed will be rendered."); .on_hover_text("If off, you have to click to show content-warning tagged media. If on, all content-warning tagged media in your feed will be rendered.");
ui.checkbox(
&mut app.settings.hide_mutes_entirely,
"Hide muted events entirely, including replies to them",
)
.on_hover_text("If on, muted events wont be in the feed at all. If off, they will be in the feed, but the content will be replaced with the word MUTED. You will see replies to them, and you can peek at the content by viewing the note in raw form.");
ui.checkbox( ui.checkbox(
&mut app.settings.show_deleted_events, &mut app.settings.show_deleted_events,
"Render delete events, but labeled as deleted", "Render delete events, but labeled as deleted",

View File

@ -66,6 +66,7 @@ pub struct Settings {
pub future_allowance_secs: u64, pub future_allowance_secs: u64,
// Event Content Settings // Event Content Settings
pub hide_mutes_entirely: bool,
pub reactions: bool, pub reactions: bool,
pub enable_zap_receipts: bool, pub enable_zap_receipts: bool,
pub show_media: bool, pub show_media: bool,
@ -145,6 +146,7 @@ impl Default for Settings {
show_mentions: default_setting!(show_mentions), show_mentions: default_setting!(show_mentions),
direct_messages: default_setting!(direct_messages), direct_messages: default_setting!(direct_messages),
future_allowance_secs: default_setting!(future_allowance_secs), future_allowance_secs: default_setting!(future_allowance_secs),
hide_mutes_entirely: default_setting!(hide_mutes_entirely),
reactions: default_setting!(reactions), reactions: default_setting!(reactions),
enable_zap_receipts: default_setting!(enable_zap_receipts), enable_zap_receipts: default_setting!(enable_zap_receipts),
show_media: default_setting!(show_media), show_media: default_setting!(show_media),
@ -224,6 +226,7 @@ impl Settings {
show_mentions: load_setting!(show_mentions), show_mentions: load_setting!(show_mentions),
direct_messages: load_setting!(direct_messages), direct_messages: load_setting!(direct_messages),
future_allowance_secs: load_setting!(future_allowance_secs), future_allowance_secs: load_setting!(future_allowance_secs),
hide_mutes_entirely: load_setting!(hide_mutes_entirely),
reactions: load_setting!(reactions), reactions: load_setting!(reactions),
enable_zap_receipts: load_setting!(enable_zap_receipts), enable_zap_receipts: load_setting!(enable_zap_receipts),
show_media: load_setting!(show_media), show_media: load_setting!(show_media),
@ -299,6 +302,7 @@ impl Settings {
save_setting!(show_mentions, self, txn); save_setting!(show_mentions, self, txn);
save_setting!(direct_messages, self, txn); save_setting!(direct_messages, self, txn);
save_setting!(future_allowance_secs, self, txn); save_setting!(future_allowance_secs, self, txn);
save_setting!(hide_mutes_entirely, self, txn);
save_setting!(reactions, self, txn); save_setting!(reactions, self, txn);
save_setting!(enable_zap_receipts, self, txn); save_setting!(enable_zap_receipts, self, txn);
save_setting!(show_media, self, txn); save_setting!(show_media, self, txn);

View File

@ -732,6 +732,7 @@ impl Storage {
u64, u64,
60 * 15 60 * 15
); );
def_setting!(hide_mutes_entirely, b"hide_mutes_entirely", bool, false);
def_setting!(reactions, b"reactions", bool, true); def_setting!(reactions, b"reactions", bool, true);
def_setting!(enable_zap_receipts, b"enable_zap_receipts", bool, true); def_setting!(enable_zap_receipts, b"enable_zap_receipts", bool, true);
def_setting!(show_media, b"show_media", bool, true); def_setting!(show_media, b"show_media", bool, true);