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 61658946d7 - Show all commits
+10 -13
View File
@@ -452,15 +452,14 @@ pub fn get_note(conn: &Connection, id: &str) -> rusqlite::Result<Note> {
load_note(conn, id)
}
/// Which notes' reminders are this device's to fire: the owner's, out of the trash.
/// A note shared with us neither alerts us nor is ours to clear, the same as on the
/// server.
const OWN_REMINDERS: &str = "trashed = 0 AND remind_at IS NOT NULL AND permission = 'owner'";
pub fn reminders(conn: &Connection) -> rusqlite::Result<Vec<Note>> {
// The owner's reminders: a note shared with us neither alerts us nor is ours to
// clear, the same as on the server.
notes_where(
conn,
"SELECT id FROM notes WHERE trashed = 0 AND remind_at IS NOT NULL AND permission = 'owner'
ORDER BY remind_at ASC",
[],
)
let sql = format!("SELECT id FROM notes WHERE {OWN_REMINDERS} ORDER BY remind_at ASC");
notes_where(conn, &sql, [])
}
/// Reminders due at or before `now_ms`, soonest first, trash excluded.
@@ -470,11 +469,9 @@ pub fn reminders(conn: &Connection) -> rusqlite::Result<Vec<Note>> {
/// parse is left out: it can never come due, and announcing it would be a guess.
pub fn due_reminders(conn: &Connection, now_ms: i64) -> rusqlite::Result<Vec<DueReminder>> {
let set: Vec<(String, String)> = {
let mut stmt = conn.prepare(
"SELECT id, remind_at FROM notes
WHERE trashed = 0 AND remind_at IS NOT NULL AND permission = 'owner'
ORDER BY remind_at ASC",
)?;
let mut stmt = conn.prepare(&format!(
"SELECT id, remind_at FROM notes WHERE {OWN_REMINDERS} ORDER BY remind_at ASC"
))?;
let rows = stmt.query_map([], |r| Ok((r.get(0)?, r.get(1)?)))?;
rows.collect::<rusqlite::Result<_>>()?
};