AGPL-3.0-only, a source link in the app, and everything on dev since #5 #6

Merged
bvandeusen merged 214 commits from dev into main 2026-10-21 21:40:00 -04:00
Showing only changes of commit 54b1e13750 - Show all commits
+5 -13
View File
@@ -9,7 +9,7 @@
//! patch (docs/sync.md). The server resolves conflicts last-write-wins by the client's
//! `edited_at`, snapshotting anything it overwrites into the note's version history.
use rusqlite::{params, Connection, OptionalExtension};
use rusqlite::{params, Connection};
use serde::{Deserialize, Serialize};
use super::blobs::BlobStore;
@@ -481,18 +481,10 @@ fn forget_pending_delete(conn: &Connection, change: &Change) -> rusqlite::Result
/// True when anything is waiting to go up. Cheap enough to call before a cycle.
pub fn has_pending(conn: &Connection) -> rusqlite::Result<bool> {
let pending: Option<i64> = conn
.query_row(
"SELECT 1 FROM notes WHERE dirty = 1
UNION ALL SELECT 1 FROM labels WHERE dirty = 1
UNION ALL SELECT 1 FROM pending_deletes
UNION ALL SELECT 1 FROM attachments WHERE uploaded = 0 AND upload_error IS NULL
LIMIT 1",
[],
|r| r.get(0),
)
.optional()?;
Ok(pending.is_some())
// One definition of "pending": the fingerprint's. Counting where a LIMIT 1 would
// do costs nothing on a local store, and two lists of the same four predicates
// would drift.
Ok(pending_fingerprint(conn)?.is_some())
}
/// A value that changes whenever the set of pending changes does, and stays put