WIP basic news thread rendering

This commit is contained in:
2024-07-21 12:50:21 -07:00
parent 65fcbd4b77
commit 6fae9cd018
3 changed files with 72 additions and 5 deletions

View File

@@ -243,13 +243,19 @@ impl QueryRoot {
}
async fn thread<'ctx>(&self, ctx: &Context<'ctx>, thread_id: String) -> Result<Thread, Error> {
let nm = ctx.data_unchecked::<Notmuch>();
let pool = ctx.data_unchecked::<PgPool>();
let debug_content_tree = ctx
.look_ahead()
.field("messages")
.field("body")
.field("contentTree")
.exists();
Ok(nm::thread(nm, thread_id, debug_content_tree).await?)
// TODO: look at thread_id and conditionally load newsreader
if newsreader::is_newsreader_thread(&thread_id) {
Ok(newsreader::thread(pool, thread_id).await?)
} else {
Ok(nm::thread(nm, thread_id, debug_content_tree).await?)
}
}
}