From 0174bd2751c9186b8624834aa6bb82196bb9d17e Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Tue, 3 Jan 2023 10:59:06 +1300 Subject: [PATCH] Remove settings.view_threaded, force non-threaded feed for the moment --- src/feed.rs | 16 +++++++--------- src/settings.rs | 6 ------ src/ui/feed/mod.rs | 2 +- src/ui/settings.rs | 4 ---- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/feed.rs b/src/feed.rs index 436cb24e..4ca5d693 100644 --- a/src/feed.rs +++ b/src/feed.rs @@ -87,16 +87,13 @@ impl Feed { let mut events: Vec = events .iter() .filter(|e| !GLOBALS.dismissed.blocking_read().contains(&e.id)) - .filter(|e| { - if settings.view_threaded { - e.replies_to().is_none() - } else { - true - } - }) + //.filter(|e| { for Threaded + //e.replies_to().is_none() + //}) .cloned() .collect(); + /* for threaded if settings.view_threaded { events.sort_unstable_by(|a, b| { let a_last = GLOBALS.last_reply.blocking_read().get(&a.id).cloned(); @@ -105,9 +102,10 @@ impl Feed { let b_time = b_last.unwrap_or(b.created_at); b_time.cmp(&a_time) }); - } else { - events.sort_unstable_by(|a, b| b.created_at.cmp(&a.created_at)); } + */ + + events.sort_unstable_by(|a, b| b.created_at.cmp(&a.created_at)); self.feed = events.iter().map(|e| e.id).collect(); } diff --git a/src/settings.rs b/src/settings.rs index 87bff0ec..89e9490b 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -7,7 +7,6 @@ pub const DEFAULT_FEED_CHUNK: u64 = 43200; // 12 hours pub const DEFAULT_OVERLAP: u64 = 600; // 10 minutes pub const DEFAULT_VIEW_POSTS_REFERRED_TO: bool = true; pub const DEFAULT_VIEW_POSTS_REFERRING_TO: bool = false; -pub const DEFAULT_VIEW_THREADED: bool = true; pub const DEFAULT_NUM_RELAYS_PER_PERSON: u8 = 4; pub const DEFAULT_MAX_RELAYS: u8 = 15; pub const DEFAULT_MAX_FPS: u32 = 30; @@ -21,7 +20,6 @@ pub struct Settings { pub overlap: u64, pub view_posts_referred_to: bool, pub view_posts_referring_to: bool, - pub view_threaded: bool, pub num_relays_per_person: u8, pub max_relays: u8, pub public_key: Option, @@ -39,7 +37,6 @@ impl Default for Settings { overlap: DEFAULT_OVERLAP, view_posts_referred_to: DEFAULT_VIEW_POSTS_REFERRED_TO, view_posts_referring_to: DEFAULT_VIEW_POSTS_REFERRING_TO, - view_threaded: DEFAULT_VIEW_THREADED, num_relays_per_person: DEFAULT_NUM_RELAYS_PER_PERSON, max_relays: DEFAULT_MAX_RELAYS, public_key: None, @@ -76,7 +73,6 @@ impl Settings { "view_posts_referring_to" => { settings.view_posts_referring_to = numstr_to_bool(row.1) } - "view_threaded" => settings.view_threaded = numstr_to_bool(row.1), "num_relays_per_person" => { settings.num_relays_per_person = row.1.parse::().unwrap_or(DEFAULT_NUM_RELAYS_PER_PERSON) @@ -130,7 +126,6 @@ impl Settings { ('overlap', ?),\ ('view_posts_referred_to', ?),\ ('view_posts_referring_to', ?),\ - ('view_threaded', ?),\ ('num_relays_per_person', ?),\ ('max_relays', ?),\ ('max_fps', ?),\ @@ -143,7 +138,6 @@ impl Settings { self.overlap, bool_to_numstr(self.view_posts_referred_to), bool_to_numstr(self.view_posts_referring_to), - bool_to_numstr(self.view_threaded), self.num_relays_per_person, self.max_relays, self.max_fps, diff --git a/src/ui/feed/mod.rs b/src/ui/feed/mod.rs index 6080adf4..e901dac5 100644 --- a/src/ui/feed/mod.rs +++ b/src/ui/feed/mod.rs @@ -166,7 +166,7 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram ui.separator(); - let threaded = GLOBALS.settings.blocking_read().view_threaded; + let threaded = false; ScrollArea::vertical().show(ui, |ui| { let bgcolor = if ctx.style().visuals.dark_mode { diff --git a/src/ui/settings.rs b/src/ui/settings.rs index 49c506e7..7e712af6 100644 --- a/src/ui/settings.rs +++ b/src/ui/settings.rs @@ -57,10 +57,6 @@ pub(super) fn update( ui.heading("Feed"); - ui.checkbox(&mut app.settings.view_threaded, "Threaded feed") - .on_hover_text("If selected, replies are under what they reply to and the newest replied-to thread comes first. Otherwise all posts are independent and in time order."); - - ui.add_space(24.0); ui.horizontal(|ui| { ui.label("Recompute feed every (milliseconds): ") .on_hover_text(