diff --git a/src/db/mod.rs b/src/db/mod.rs index f95f0680..b5827d13 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -112,6 +112,7 @@ fn upgrade(db: &Connection, mut version: u16) -> Result<(), Error> { apply_sql!(db, version, 8, "schema8.sql"); apply_sql!(db, version, 9, "schema9.sql"); apply_sql!(db, version, 10, "schema10.sql"); + apply_sql!(db, version, 11, "schema11.sql"); tracing::info!("Database is at version {}", version); Ok(()) } diff --git a/src/db/schema11.sql b/src/db/schema11.sql new file mode 100644 index 00000000..4b5d4492 --- /dev/null +++ b/src/db/schema11.sql @@ -0,0 +1,2 @@ +UPDATE settings SET key='thread_view_ancestors' WHERE key='view_posts_referred_to'; +UPDATE settings SET key='thread_view_replies' WHERE key='view_posts_referring_to'; diff --git a/src/settings.rs b/src/settings.rs index a0d25592..a837a9f8 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -5,8 +5,8 @@ use serde::{Deserialize, Serialize}; pub const DEFAULT_FEED_CHUNK: u64 = 43200; // 12 hours pub const DEFAULT_OVERLAP: u64 = 300; // 5 minutes -pub const DEFAULT_VIEW_POSTS_REFERRED_TO: bool = true; -pub const DEFAULT_VIEW_POSTS_REFERRING_TO: bool = false; +pub const DEFAULT_THREAD_VIEW_ANCESTORS: bool = true; +pub const DEFAULT_THREAD_VIEW_REPLIES: bool = false; pub const DEFAULT_NUM_RELAYS_PER_PERSON: u8 = 3; pub const DEFAULT_MAX_RELAYS: u8 = 15; pub const DEFAULT_MAX_FPS: u32 = 15; @@ -20,8 +20,8 @@ pub const DEFAULT_SET_CLIENT_TAG: bool = false; pub struct Settings { pub feed_chunk: u64, pub overlap: u64, - pub view_posts_referred_to: bool, - pub view_posts_referring_to: bool, + pub thread_view_ancestors: bool, + pub thread_view_replies: bool, pub num_relays_per_person: u8, pub max_relays: u8, pub public_key: Option, @@ -39,8 +39,8 @@ impl Default for Settings { Settings { feed_chunk: DEFAULT_FEED_CHUNK, overlap: DEFAULT_OVERLAP, - view_posts_referred_to: DEFAULT_VIEW_POSTS_REFERRED_TO, - view_posts_referring_to: DEFAULT_VIEW_POSTS_REFERRING_TO, + thread_view_ancestors: DEFAULT_THREAD_VIEW_ANCESTORS, + thread_view_replies: DEFAULT_THREAD_VIEW_REPLIES, num_relays_per_person: DEFAULT_NUM_RELAYS_PER_PERSON, max_relays: DEFAULT_MAX_RELAYS, public_key: None, @@ -75,10 +75,8 @@ impl Settings { settings.feed_chunk = row.1.parse::().unwrap_or(DEFAULT_FEED_CHUNK) } "overlap" => settings.overlap = row.1.parse::().unwrap_or(DEFAULT_OVERLAP), - "view_posts_referred_to" => settings.view_posts_referred_to = numstr_to_bool(row.1), - "view_posts_referring_to" => { - settings.view_posts_referring_to = numstr_to_bool(row.1) - } + "thread_view_ancestors" => settings.thread_view_ancestors = numstr_to_bool(row.1), + "thread_view_replies" => settings.thread_view_replies = numstr_to_bool(row.1), "num_relays_per_person" => { settings.num_relays_per_person = row.1.parse::().unwrap_or(DEFAULT_NUM_RELAYS_PER_PERSON) @@ -132,8 +130,8 @@ impl Settings { "REPLACE INTO settings (key, value) VALUES \ ('feed_chunk', ?),\ ('overlap', ?),\ - ('view_posts_referred_to', ?),\ - ('view_posts_referring_to', ?),\ + ('thread_view_ancestors', ?),\ + ('thread_view_replies', ?),\ ('num_relays_per_person', ?),\ ('max_relays', ?),\ ('max_fps', ?),\ @@ -146,8 +144,8 @@ impl Settings { stmt.execute(( self.feed_chunk, self.overlap, - bool_to_numstr(self.view_posts_referred_to), - bool_to_numstr(self.view_posts_referring_to), + bool_to_numstr(self.thread_view_ancestors), + bool_to_numstr(self.thread_view_replies), self.num_relays_per_person, self.max_relays, self.max_fps, diff --git a/src/ui/settings.rs b/src/ui/settings.rs index 8b4d2e3b..18b7e523 100644 --- a/src/ui/settings.rs +++ b/src/ui/settings.rs @@ -66,15 +66,14 @@ pub(super) fn update(app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Fr ui.heading("What Posts to Include"); ui.checkbox( - &mut app.settings.view_posts_referred_to, - "View posts referred to by people you follow (not yet implemented)", - ) - .on_hover_text( - "Recommended, otherwise it's hard to understand what the person is talking about.", + &mut app.settings.thread_view_ancestors, + "In thread view, view entire ancestoral line of a post, not just it's parent (not yet implemented)", ); - ui.checkbox(&mut app.settings.view_posts_referring_to, "View posts referring to posts by people you follow (not yet implemented)") - .on_hover_text("Not recommended, as anyone can reply to them and you'll certainly encounter spam this way."); + ui.checkbox( + &mut app.settings.thread_view_replies, + "In thread view, view all replies to a post recursively on down (not yet implemented)", + ); ui.add_space(12.0); ui.separator();