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]>
1 file
changed +4
−3
src/actions.ts +4 −3
| @@ -111,7 +111,7 @@ export function listNotes( | ||
| 111 | 111 | return ok( |
| 112 | 112 | db |
| 113 | 113 | .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", | |
| 115 | 115 | ) |
| 116 | 116 | .all(who.id, limit), |
| 117 | 117 | ); |
| @@ -295,9 +295,10 @@ function update( | ||
| 295 | 295 | const note = db.transaction(() => { |
| 296 | 296 | const saved = db |
| 297 | 297 | .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 *", | |
| 299 | 300 | ) |
| 300 | .get(title, body, pinned, before.id)!; | |
| 301 | .get(title, body, pinned, before.id, title !== before.title || body !== before.body ? 1 : 0)!; | |
| 301 | 302 | if (renamed || title !== before.title) |
| 302 | 303 | for (const other of db |
| 303 | 304 | .query<Note, [string, number]>("SELECT * FROM note WHERE author_id = ?1 AND id != ?2") |