mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 19:46:50 +00:00
Rename settings regarding posts to view
This commit is contained in:
parent
ea6de6deec
commit
5a48e40956
@ -112,6 +112,7 @@ fn upgrade(db: &Connection, mut version: u16) -> Result<(), Error> {
|
|||||||
apply_sql!(db, version, 8, "schema8.sql");
|
apply_sql!(db, version, 8, "schema8.sql");
|
||||||
apply_sql!(db, version, 9, "schema9.sql");
|
apply_sql!(db, version, 9, "schema9.sql");
|
||||||
apply_sql!(db, version, 10, "schema10.sql");
|
apply_sql!(db, version, 10, "schema10.sql");
|
||||||
|
apply_sql!(db, version, 11, "schema11.sql");
|
||||||
tracing::info!("Database is at version {}", version);
|
tracing::info!("Database is at version {}", version);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
2
src/db/schema11.sql
Normal file
2
src/db/schema11.sql
Normal file
@ -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';
|
@ -5,8 +5,8 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
pub const DEFAULT_FEED_CHUNK: u64 = 43200; // 12 hours
|
pub const DEFAULT_FEED_CHUNK: u64 = 43200; // 12 hours
|
||||||
pub const DEFAULT_OVERLAP: u64 = 300; // 5 minutes
|
pub const DEFAULT_OVERLAP: u64 = 300; // 5 minutes
|
||||||
pub const DEFAULT_VIEW_POSTS_REFERRED_TO: bool = true;
|
pub const DEFAULT_THREAD_VIEW_ANCESTORS: bool = true;
|
||||||
pub const DEFAULT_VIEW_POSTS_REFERRING_TO: bool = false;
|
pub const DEFAULT_THREAD_VIEW_REPLIES: bool = false;
|
||||||
pub const DEFAULT_NUM_RELAYS_PER_PERSON: u8 = 3;
|
pub const DEFAULT_NUM_RELAYS_PER_PERSON: u8 = 3;
|
||||||
pub const DEFAULT_MAX_RELAYS: u8 = 15;
|
pub const DEFAULT_MAX_RELAYS: u8 = 15;
|
||||||
pub const DEFAULT_MAX_FPS: u32 = 15;
|
pub const DEFAULT_MAX_FPS: u32 = 15;
|
||||||
@ -20,8 +20,8 @@ pub const DEFAULT_SET_CLIENT_TAG: bool = false;
|
|||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
pub feed_chunk: u64,
|
pub feed_chunk: u64,
|
||||||
pub overlap: u64,
|
pub overlap: u64,
|
||||||
pub view_posts_referred_to: bool,
|
pub thread_view_ancestors: bool,
|
||||||
pub view_posts_referring_to: bool,
|
pub thread_view_replies: bool,
|
||||||
pub num_relays_per_person: u8,
|
pub num_relays_per_person: u8,
|
||||||
pub max_relays: u8,
|
pub max_relays: u8,
|
||||||
pub public_key: Option<PublicKey>,
|
pub public_key: Option<PublicKey>,
|
||||||
@ -39,8 +39,8 @@ impl Default for Settings {
|
|||||||
Settings {
|
Settings {
|
||||||
feed_chunk: DEFAULT_FEED_CHUNK,
|
feed_chunk: DEFAULT_FEED_CHUNK,
|
||||||
overlap: DEFAULT_OVERLAP,
|
overlap: DEFAULT_OVERLAP,
|
||||||
view_posts_referred_to: DEFAULT_VIEW_POSTS_REFERRED_TO,
|
thread_view_ancestors: DEFAULT_THREAD_VIEW_ANCESTORS,
|
||||||
view_posts_referring_to: DEFAULT_VIEW_POSTS_REFERRING_TO,
|
thread_view_replies: DEFAULT_THREAD_VIEW_REPLIES,
|
||||||
num_relays_per_person: DEFAULT_NUM_RELAYS_PER_PERSON,
|
num_relays_per_person: DEFAULT_NUM_RELAYS_PER_PERSON,
|
||||||
max_relays: DEFAULT_MAX_RELAYS,
|
max_relays: DEFAULT_MAX_RELAYS,
|
||||||
public_key: None,
|
public_key: None,
|
||||||
@ -75,10 +75,8 @@ impl Settings {
|
|||||||
settings.feed_chunk = row.1.parse::<u64>().unwrap_or(DEFAULT_FEED_CHUNK)
|
settings.feed_chunk = row.1.parse::<u64>().unwrap_or(DEFAULT_FEED_CHUNK)
|
||||||
}
|
}
|
||||||
"overlap" => settings.overlap = row.1.parse::<u64>().unwrap_or(DEFAULT_OVERLAP),
|
"overlap" => settings.overlap = row.1.parse::<u64>().unwrap_or(DEFAULT_OVERLAP),
|
||||||
"view_posts_referred_to" => settings.view_posts_referred_to = numstr_to_bool(row.1),
|
"thread_view_ancestors" => settings.thread_view_ancestors = numstr_to_bool(row.1),
|
||||||
"view_posts_referring_to" => {
|
"thread_view_replies" => settings.thread_view_replies = numstr_to_bool(row.1),
|
||||||
settings.view_posts_referring_to = numstr_to_bool(row.1)
|
|
||||||
}
|
|
||||||
"num_relays_per_person" => {
|
"num_relays_per_person" => {
|
||||||
settings.num_relays_per_person =
|
settings.num_relays_per_person =
|
||||||
row.1.parse::<u8>().unwrap_or(DEFAULT_NUM_RELAYS_PER_PERSON)
|
row.1.parse::<u8>().unwrap_or(DEFAULT_NUM_RELAYS_PER_PERSON)
|
||||||
@ -132,8 +130,8 @@ impl Settings {
|
|||||||
"REPLACE INTO settings (key, value) VALUES \
|
"REPLACE INTO settings (key, value) VALUES \
|
||||||
('feed_chunk', ?),\
|
('feed_chunk', ?),\
|
||||||
('overlap', ?),\
|
('overlap', ?),\
|
||||||
('view_posts_referred_to', ?),\
|
('thread_view_ancestors', ?),\
|
||||||
('view_posts_referring_to', ?),\
|
('thread_view_replies', ?),\
|
||||||
('num_relays_per_person', ?),\
|
('num_relays_per_person', ?),\
|
||||||
('max_relays', ?),\
|
('max_relays', ?),\
|
||||||
('max_fps', ?),\
|
('max_fps', ?),\
|
||||||
@ -146,8 +144,8 @@ impl Settings {
|
|||||||
stmt.execute((
|
stmt.execute((
|
||||||
self.feed_chunk,
|
self.feed_chunk,
|
||||||
self.overlap,
|
self.overlap,
|
||||||
bool_to_numstr(self.view_posts_referred_to),
|
bool_to_numstr(self.thread_view_ancestors),
|
||||||
bool_to_numstr(self.view_posts_referring_to),
|
bool_to_numstr(self.thread_view_replies),
|
||||||
self.num_relays_per_person,
|
self.num_relays_per_person,
|
||||||
self.max_relays,
|
self.max_relays,
|
||||||
self.max_fps,
|
self.max_fps,
|
||||||
|
@ -66,15 +66,14 @@ pub(super) fn update(app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Fr
|
|||||||
ui.heading("What Posts to Include");
|
ui.heading("What Posts to Include");
|
||||||
|
|
||||||
ui.checkbox(
|
ui.checkbox(
|
||||||
&mut app.settings.view_posts_referred_to,
|
&mut app.settings.thread_view_ancestors,
|
||||||
"View posts referred to by people you follow (not yet implemented)",
|
"In thread view, view entire ancestoral line of a post, not just it's parent (not yet implemented)",
|
||||||
)
|
|
||||||
.on_hover_text(
|
|
||||||
"Recommended, otherwise it's hard to understand what the person is talking about.",
|
|
||||||
);
|
);
|
||||||
|
|
||||||
ui.checkbox(&mut app.settings.view_posts_referring_to, "View posts referring to posts by people you follow (not yet implemented)")
|
ui.checkbox(
|
||||||
.on_hover_text("Not recommended, as anyone can reply to them and you'll certainly encounter spam this way.");
|
&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.add_space(12.0);
|
||||||
ui.separator();
|
ui.separator();
|
||||||
|
Loading…
Reference in New Issue
Block a user