threads: add initial thread support
This is a really dumb and broken version of threads, but it will be our foundation for future changes. All it currently does is load whatever notes we have locally for a thread in chronological order. It currently does not open any subscriptions. It is not clear what is replying to what, but hey, its a start. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
24
src/app.rs
24
src/app.rs
@@ -10,6 +10,7 @@ use crate::note::NoteRef;
|
||||
use crate::notecache::{CachedNote, NoteCache};
|
||||
use crate::relay_pool_manager::RelayPoolManager;
|
||||
use crate::route::Route;
|
||||
use crate::thread::Threads;
|
||||
use crate::timeline;
|
||||
use crate::timeline::{MergeKind, Timeline, ViewFilter};
|
||||
use crate::ui::note::PostAction;
|
||||
@@ -53,10 +54,11 @@ pub struct Damus {
|
||||
|
||||
pub timelines: Vec<Timeline>,
|
||||
pub selected_timeline: i32,
|
||||
pub drafts: Drafts,
|
||||
|
||||
pub img_cache: ImageCache,
|
||||
pub ndb: Ndb,
|
||||
pub drafts: Drafts,
|
||||
pub threads: Threads,
|
||||
pub img_cache: ImageCache,
|
||||
pub account_manager: AccountManager,
|
||||
|
||||
frame_history: crate::frame_history::FrameHistory,
|
||||
@@ -820,6 +822,7 @@ impl Damus {
|
||||
Self {
|
||||
pool,
|
||||
is_mobile,
|
||||
threads: Threads::default(),
|
||||
drafts: Drafts::default(),
|
||||
state: DamusState::Initializing,
|
||||
img_cache: ImageCache::new(imgcache_dir),
|
||||
@@ -849,6 +852,7 @@ impl Damus {
|
||||
config.set_ingester_threads(2);
|
||||
Self {
|
||||
is_mobile,
|
||||
threads: Threads::default(),
|
||||
drafts: Drafts::default(),
|
||||
state: DamusState::Initializing,
|
||||
pool: RelayPool::new(),
|
||||
@@ -1013,11 +1017,6 @@ fn render_nav(routes: Vec<Route>, timeline_ind: usize, app: &mut Damus, ui: &mut
|
||||
None
|
||||
}
|
||||
|
||||
Route::Thread(_key) => {
|
||||
ui.label("thread view");
|
||||
None
|
||||
}
|
||||
|
||||
Route::Relays => {
|
||||
let pool = &mut app_ctx.borrow_mut().pool;
|
||||
let manager = RelayPoolManager::new(pool);
|
||||
@@ -1025,6 +1024,17 @@ fn render_nav(routes: Vec<Route>, timeline_ind: usize, app: &mut Damus, ui: &mut
|
||||
None
|
||||
}
|
||||
|
||||
Route::Thread(id) => {
|
||||
let app = &mut app_ctx.borrow_mut();
|
||||
if let Ok(txn) = Transaction::new(&app.ndb) {
|
||||
if let Ok(note) = app.ndb.get_note_by_id(&txn, id.bytes()) {
|
||||
ui::ThreadView::new(app, timeline_ind, ¬e).ui(ui);
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
Route::Reply(id) => {
|
||||
let mut app = app_ctx.borrow_mut();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user