Changeset 8151340 in Klonkt for src/services/ap-timeline.js
- Timestamp:
- 09/04/2026 12:05:08 PM (5 days ago)
- Branches:
- main
- Children:
- 9946a68
- Parents:
- aa521c3
- File:
-
- 1 edited
-
src/services/ap-timeline.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ap-timeline.js
raa521c3 r8151340 13 13 * wireTimeline, hetzelfde injectiepatroon als guardianship en ap-c2s. 14 14 */ 15 import db from '../config/database.js'; 15 import db, { isoSql } from '../config/database.js'; 16 17 // De helper woont sinds shaer-a937 in config/database.js: elke plek die 18 // sorteert had hem nodig, en twee kopieen van dezelfde regel lopen uit elkaar. 19 // Bovenaan, want de eerste statements hieronder gebruiken hem al. 20 const STEMPEL = isoSql; 16 21 17 22 // Het ene werktuig uit de dienstlaag. ActivityPubService vult het onderaan … … 26 31 if (!_insTl) { 27 32 _insTl = db.prepare('INSERT OR IGNORE INTO ap_timeline (id, slug, author_uri, author_name, author_handle, author_icon, author_url, content, url, published, media_json, nsfw, cw, created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,CURRENT_TIMESTAMP)'); 28 _listTl = db.prepare( 'SELECT * FROM ap_timeline WHERE slug = ? ORDER BY COALESCE(published, created_at) DESC LIMIT ? OFFSET ?');33 _listTl = db.prepare(`SELECT * FROM ap_timeline WHERE slug = ? ORDER BY ${STEMPEL('COALESCE(published, created_at)')} DESC LIMIT ? OFFSET ?`); 29 34 _delTl = db.prepare('DELETE FROM ap_timeline WHERE id = ?'); 30 35 } … … 119 124 JOIN sites s ON s.id = p.site_id 120 125 WHERE s.slug = ? AND i.kind = 'reply' 121 ORDER BY COALESCE(i.published, i.created_at)DESC LIMIT ?`).all(slug, limit || 60);126 ORDER BY ${STEMPEL('COALESCE(i.published, i.created_at)')} DESC LIMIT ?`).all(slug, limit || 60); 122 127 } catch { return []; } 123 128 } … … 242 247 * een leeftijd die twee uur verschilde per vorm. 243 248 */ 244 const STEMPEL = (rauw) => `COALESCE(strftime('%Y-%m-%dT%H:%M:%SZ', ${rauw}), ${rauw})`;245 249 246 250 const CONVERSATION_UNION = ` … … 425 429 WHERE m.slug = ? 426 430 AND NOT EXISTS (SELECT 1 FROM ap_timeline t WHERE t.slug = m.slug AND t.id = m.object_uri) 427 ORDER BY COALESCE(m.published, m.created_at)DESC LIMIT ?`).all(slug, limit || 60);431 ORDER BY ${STEMPEL('COALESCE(m.published, m.created_at)')} DESC LIMIT ?`).all(slug, limit || 60); 428 432 } catch { return []; } 429 433 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)