benjivers/notes Public Public: anyone can read this; nobody can change it.

Pinning is not an edit: it no longer bumps a note's recency

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Benjivers-bit committed 7260e8f Browse files
1 file changed +4 −3
src/actions.ts +4 −3
@@ -111,7 +111,7 @@ export function listNotes(
111111 return ok(
112112 db
113113 .query<Note, [string, number]>(
114 "SELECT * FROM note WHERE author_id = ?1 ORDER BY pinned DESC, updated_at DESC LIMIT ?2",
114 "SELECT * FROM note WHERE author_id = ?1 ORDER BY pinned DESC, updated_at DESC, id DESC LIMIT ?2",
115115 )
116116 .all(who.id, limit),
117117 );
@@ -295,9 +295,10 @@ function update(
295295 const note = db.transaction(() => {
296296 const saved = db
297297 .query<Note, [string, string, number, number]>(
298 "UPDATE note SET title = ?1, body = ?2, pinned = ?3, updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now') WHERE id = ?4 RETURNING *",
298 // A pin is not an edit: only new words or a new title move a note up by recency.
299 "UPDATE note SET title = ?1, body = ?2, pinned = ?3, updated_at = CASE WHEN ?5 THEN strftime('%Y-%m-%dT%H:%M:%fZ', 'now') ELSE updated_at END WHERE id = ?4 RETURNING *",
299300 )
300 .get(title, body, pinned, before.id)!;
301 .get(title, body, pinned, before.id, title !== before.title || body !== before.body ? 1 : 0)!;
301302 if (renamed || title !== before.title)
302303 for (const other of db
303304 .query<Note, [string, number]>("SELECT * FROM note WHERE author_id = ?1 AND id != ?2")
↑↓ navigate ↵ open esc close

Keyboard shortcuts