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",
|
"sha2 0.10.9",
|
||||||
"smallvec 1.15.1",
|
"smallvec 1.15.1",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
"time 0.3.44",
|
|
||||||
"tokio 1.48.0",
|
"tokio 1.48.0",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tracing",
|
"tracing",
|
||||||
@ -5708,7 +5707,6 @@ dependencies = [
|
|||||||
"sqlx-core",
|
"sqlx-core",
|
||||||
"stringprep",
|
"stringprep",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
"time 0.3.44",
|
|
||||||
"tracing",
|
"tracing",
|
||||||
"whoami",
|
"whoami",
|
||||||
]
|
]
|
||||||
@ -5747,7 +5745,6 @@ dependencies = [
|
|||||||
"sqlx-core",
|
"sqlx-core",
|
||||||
"stringprep",
|
"stringprep",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
"time 0.3.44",
|
|
||||||
"tracing",
|
"tracing",
|
||||||
"whoami",
|
"whoami",
|
||||||
]
|
]
|
||||||
@ -5773,7 +5770,6 @@ dependencies = [
|
|||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
"sqlx-core",
|
"sqlx-core",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
"time 0.3.44",
|
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -45,7 +45,7 @@ reqwest = { version = "0.12.15", features = ["blocking"] }
|
|||||||
scraper = "0.24.0"
|
scraper = "0.24.0"
|
||||||
serde = { version = "1.0.219", features = ["derive"] }
|
serde = { version = "1.0.219", features = ["derive"] }
|
||||||
serde_json = "1.0.140"
|
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 }
|
tantivy = { version = "0.25.0", optional = true }
|
||||||
thiserror = "2.0.12"
|
thiserror = "2.0.12"
|
||||||
tokio = "1.44.2"
|
tokio = "1.44.2"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
-- Add up migration script here
|
-- Add up migration script here
|
||||||
CREATE TABLE IF NOT EXISTS snooze (
|
CREATE TABLE IF NOT EXISTS snooze (
|
||||||
id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
|
id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
|
||||||
message_id text NOT NULL,
|
message_id text NOT NULL UNIQUE,
|
||||||
wake timestamptz NOT NULL
|
wake timestamptz NOT NULL
|
||||||
);
|
);
|
||||||
|
|||||||
@ -642,12 +642,27 @@ impl MutationRoot {
|
|||||||
r#"
|
r#"
|
||||||
INSERT INTO snooze (message_id, wake)
|
INSERT INTO snooze (message_id, wake)
|
||||||
VALUES ($1, $2)
|
VALUES ($1, $2)
|
||||||
|
ON CONFLICT (message_id) DO UPDATE
|
||||||
|
SET wake = $2
|
||||||
"#,
|
"#,
|
||||||
query,
|
query,
|
||||||
wake_time
|
wake_time
|
||||||
)
|
)
|
||||||
.execute(pool)
|
.execute(pool)
|
||||||
.await?;
|
.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)
|
Ok(true)
|
||||||
}
|
}
|
||||||
/// Drop and recreate tantivy index. Warning this is slow
|
/// Drop and recreate tantivy index. Warning this is slow
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user