server: add ability to add/remove labels
This commit is contained in:
parent
a24f456136
commit
1b196a2703
@ -3,7 +3,6 @@ use std::{
|
|||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
fs::File,
|
fs::File,
|
||||||
hash::{DefaultHasher, Hash, Hasher},
|
hash::{DefaultHasher, Hash, Hasher},
|
||||||
str::FromStr,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use async_graphql::{
|
use async_graphql::{
|
||||||
@ -427,6 +426,28 @@ impl Mutation {
|
|||||||
}
|
}
|
||||||
Ok(true)
|
Ok(true)
|
||||||
}
|
}
|
||||||
|
async fn tag_add<'ctx>(
|
||||||
|
&self,
|
||||||
|
ctx: &Context<'ctx>,
|
||||||
|
query: String,
|
||||||
|
tag: String,
|
||||||
|
) -> Result<bool, Error> {
|
||||||
|
let nm = ctx.data_unchecked::<Notmuch>();
|
||||||
|
info!("tag_add({tag}, {query})");
|
||||||
|
nm.tag_add(&tag, &query)?;
|
||||||
|
Ok(true)
|
||||||
|
}
|
||||||
|
async fn tag_remove<'ctx>(
|
||||||
|
&self,
|
||||||
|
ctx: &Context<'ctx>,
|
||||||
|
query: String,
|
||||||
|
tag: String,
|
||||||
|
) -> Result<bool, Error> {
|
||||||
|
let nm = ctx.data_unchecked::<Notmuch>();
|
||||||
|
info!("tag_remove({tag}, {query})");
|
||||||
|
nm.tag_remove(&tag, &query)?;
|
||||||
|
Ok(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type GraphqlSchema = Schema<QueryRoot, Mutation, EmptySubscription>;
|
pub type GraphqlSchema = Schema<QueryRoot, Mutation, EmptySubscription>;
|
||||||
|
|||||||
@ -83,6 +83,8 @@ pub fn sanitize_html(html: &str) -> Result<String, SanitizeError> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Default's don't allow style, but we want to preserve that.
|
// Default's don't allow style, but we want to preserve that.
|
||||||
|
// TODO: remove 'class' if rendering mails moves to a two phase process where abstract message
|
||||||
|
// types are collected, santized, and then grouped together as one big HTML doc
|
||||||
let attributes = hashset![
|
let attributes = hashset![
|
||||||
"align", "bgcolor", "class", "color", "height", "lang", "title", "width", "style",
|
"align", "bgcolor", "class", "color", "height", "lang", "title", "width", "style",
|
||||||
];
|
];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user