Handle needs_unread on tag query. Move News to top of tag list
This commit is contained in:
@@ -244,8 +244,8 @@ impl QueryRoot {
|
||||
let nm = ctx.data_unchecked::<Notmuch>();
|
||||
let pool = ctx.data_unchecked::<PgPool>();
|
||||
let needs_unread = ctx.look_ahead().field("unread").exists();
|
||||
let mut tags = nm::tags(nm, needs_unread)?;
|
||||
tags.append(&mut newsreader::tags(pool, needs_unread).await?);
|
||||
let mut tags = newsreader::tags(pool, needs_unread).await?;
|
||||
tags.append(&mut nm::tags(nm, needs_unread)?);
|
||||
Ok(tags)
|
||||
}
|
||||
async fn thread<'ctx>(&self, ctx: &Context<'ctx>, thread_id: String) -> Result<Thread, Error> {
|
||||
|
||||
@@ -92,7 +92,9 @@ pub async fn search(
|
||||
|
||||
pub async fn tags(pool: &PgPool, needs_unread: bool) -> Result<Vec<Tag>, ServerError> {
|
||||
// TODO: write separate query for needs_unread.
|
||||
let tags = sqlx::query_file!("sql/tags.sql").fetch_all(pool).await?;
|
||||
let tags = sqlx::query_file!("sql/tags.sql", needs_unread)
|
||||
.fetch_all(pool)
|
||||
.await?;
|
||||
let tags = tags
|
||||
.into_iter()
|
||||
.map(|tag| {
|
||||
|
||||
Reference in New Issue
Block a user