Upsert snoozes and mark snoozed messages as read
This commit is contained in:
parent
50a4bfcac7
commit
a8129e4685
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -5624,7 +5624,6 @@ dependencies = [
|
||||
"sha2 0.10.9",
|
||||
"smallvec 1.15.1",
|
||||
"thiserror 2.0.17",
|
||||
"time 0.3.44",
|
||||
"tokio 1.48.0",
|
||||
"tokio-stream",
|
||||
"tracing",
|
||||
@ -5708,7 +5707,6 @@ dependencies = [
|
||||
"sqlx-core",
|
||||
"stringprep",
|
||||
"thiserror 2.0.17",
|
||||
"time 0.3.44",
|
||||
"tracing",
|
||||
"whoami",
|
||||
]
|
||||
@ -5747,7 +5745,6 @@ dependencies = [
|
||||
"sqlx-core",
|
||||
"stringprep",
|
||||
"thiserror 2.0.17",
|
||||
"time 0.3.44",
|
||||
"tracing",
|
||||
"whoami",
|
||||
]
|
||||
@ -5773,7 +5770,6 @@ dependencies = [
|
||||
"serde_urlencoded",
|
||||
"sqlx-core",
|
||||
"thiserror 2.0.17",
|
||||
"time 0.3.44",
|
||||
"tracing",
|
||||
"url",
|
||||
]
|
||||
|
||||
@ -45,7 +45,7 @@ reqwest = { version = "0.12.15", features = ["blocking"] }
|
||||
scraper = "0.24.0"
|
||||
serde = { version = "1.0.219", features = ["derive"] }
|
||||
serde_json = "1.0.140"
|
||||
sqlx = { version = "0.8.5", features = ["postgres", "runtime-tokio", "time", "chrono"] }
|
||||
sqlx = { version = "0.8.5", features = ["postgres", "runtime-tokio", "chrono"] }
|
||||
tantivy = { version = "0.25.0", optional = true }
|
||||
thiserror = "2.0.12"
|
||||
tokio = "1.44.2"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
-- Add up migration script here
|
||||
CREATE TABLE IF NOT EXISTS snooze (
|
||||
id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
|
||||
message_id text NOT NULL,
|
||||
message_id text NOT NULL UNIQUE,
|
||||
wake timestamptz NOT NULL
|
||||
);
|
||||
|
||||
@ -642,12 +642,27 @@ impl MutationRoot {
|
||||
r#"
|
||||
INSERT INTO snooze (message_id, wake)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT (message_id) DO UPDATE
|
||||
SET wake = $2
|
||||
"#,
|
||||
query,
|
||||
wake_time
|
||||
)
|
||||
.execute(pool)
|
||||
.await?;
|
||||
|
||||
let nm = ctx.data_unchecked::<Notmuch>();
|
||||
let pool = ctx.data_unchecked::<PgPool>();
|
||||
#[cfg(feature = "tantivy")]
|
||||
let tantivy = ctx.data_unchecked::<TantivyConnection>();
|
||||
|
||||
let unread = false;
|
||||
let query: Query = query.parse()?;
|
||||
newsreader::set_read_status(pool, &query, unread).await?;
|
||||
#[cfg(feature = "tantivy")]
|
||||
tantivy.reindex_thread(pool, &query).await?;
|
||||
nm::set_read_status(nm, &query, unread).await?;
|
||||
|
||||
Ok(true)
|
||||
}
|
||||
/// Drop and recreate tantivy index. Warning this is slow
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user