WIP snooze feature
This commit is contained in:
parent
be2085b397
commit
2eb4784e83
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -233,6 +233,7 @@ dependencies = [
|
||||
"async-trait",
|
||||
"base64 0.22.1",
|
||||
"bytes 1.10.1",
|
||||
"chrono",
|
||||
"fast_chemail",
|
||||
"fnv",
|
||||
"futures-timer",
|
||||
|
||||
@ -17,7 +17,7 @@ html2text = "0.16"
|
||||
ammonia = "4.1.0"
|
||||
anyhow = "1.0.98"
|
||||
askama = { version = "0.14.0", features = ["derive"] }
|
||||
async-graphql = { version = "7", features = ["log"] }
|
||||
async-graphql = { version = "7", features = ["log", "chrono"] }
|
||||
async-graphql-axum = "7.0.16"
|
||||
async-trait = "0.1.88"
|
||||
axum = { version = "0.8.3", features = ["ws"] }
|
||||
|
||||
@ -7,6 +7,7 @@ use async_graphql::{
|
||||
Union,
|
||||
};
|
||||
use cacher::FilesystemCacher;
|
||||
use chrono::{DateTime, Utc};
|
||||
use futures::stream;
|
||||
use letterbox_notmuch::Notmuch;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -628,6 +629,16 @@ impl MutationRoot {
|
||||
nm.tag_remove(&tag, &query)?;
|
||||
Ok(true)
|
||||
}
|
||||
#[instrument(skip_all, fields(query=query, wake_time=wake_time.to_string(), rid=request_id()))]
|
||||
async fn snooze<'ctx>(
|
||||
&self,
|
||||
ctx: &Context<'ctx>,
|
||||
query: String,
|
||||
wake_time: DateTime<Utc>,
|
||||
) -> Result<bool, Error> {
|
||||
info!("TODO snooze {query} until {wake_time})");
|
||||
Ok(true)
|
||||
}
|
||||
/// Drop and recreate tantivy index. Warning this is slow
|
||||
#[cfg(feature = "tantivy")]
|
||||
async fn drop_and_load_index<'ctx>(&self, ctx: &Context<'ctx>) -> Result<bool, Error> {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use graphql_client::GraphQLQuery;
|
||||
use letterbox_shared::WebsocketMessage;
|
||||
use log::{debug, error, info, warn};
|
||||
@ -259,6 +260,9 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
Msg::GoToSearchResults
|
||||
});
|
||||
}
|
||||
Msg::Snooze(message_id, snooze_time) => {
|
||||
info!("TODO: Snoozing {message_id} until {snooze_time}");
|
||||
}
|
||||
|
||||
Msg::FrontPageRequest {
|
||||
query,
|
||||
@ -813,6 +817,7 @@ pub enum Msg {
|
||||
SetUnread(String, bool),
|
||||
AddTag(String, String),
|
||||
RemoveTag(String, String),
|
||||
Snooze(String, DateTime<Utc>),
|
||||
|
||||
FrontPageRequest {
|
||||
query: String,
|
||||
|
||||
@ -799,6 +799,43 @@ fn render_open_header(msg: &ShowThreadQueryThreadOnEmailThreadMessages) -> Node<
|
||||
})
|
||||
]
|
||||
]),
|
||||
div![
|
||||
C!["text-xs"],
|
||||
span!["Snooze:"],
|
||||
" ",
|
||||
a![
|
||||
"1d",
|
||||
ev(Ev::Click, {
|
||||
let id = id.clone();
|
||||
move |e| {
|
||||
e.stop_propagation();
|
||||
Msg::Snooze(id, Utc::now() + chrono::Days::new(1))
|
||||
}
|
||||
})
|
||||
],
|
||||
" ",
|
||||
a![
|
||||
"7d",
|
||||
ev(Ev::Click, {
|
||||
let id = id.clone();
|
||||
move |e| {
|
||||
e.stop_propagation();
|
||||
Msg::Snooze(id, Utc::now() + chrono::Days::new(7))
|
||||
}
|
||||
})
|
||||
],
|
||||
" ",
|
||||
a![
|
||||
"6m",
|
||||
ev(Ev::Click, {
|
||||
let id = id.clone();
|
||||
move |e| {
|
||||
e.stop_propagation();
|
||||
Msg::Snooze(id, Utc::now() + chrono::Days::new(180))
|
||||
}
|
||||
})
|
||||
],
|
||||
]
|
||||
],
|
||||
span![
|
||||
C!["text-right"],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user