Changeset 6dd1a3f in Klonkt for src


Ignore:
Timestamp:
07/04/2026 05:26:26 PM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
14f54a7
Parents:
236e11b
Message:

fix(ap): upsertBoostedNote refreshes an already-cached row

Root cause of "cover still missing on sound-fabrics" after both earlier
fixes: the self-heal is once-per-version and silently skips a note whose
fetch fails at that moment (the phone-hosted origin was briefly
unreachable when v6 ran), and upsertBoostedNote was INSERT OR IGNORE
only - so the stale coverless row could never be repaired, not even by
boosting the post again.

Now, when the INSERT is ignored because the row exists, the row is
UPDATEd with the freshly resolved note (content, media/cover, nsfw, cw,
url). Boosting a post again therefore always heals its cached copy.

Verified in isolation against the real schema: stale coverless row +
re-boost -> cover present, content refreshed. Suite 45/45.

  • src/services/ActivityPubService.js - update branch in upsertBoostedNote
  • CHANGELOG(.nl/.de).md - extended the existing Unreleased bullet (3 languages)

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r236e11b r6dd1a3f  
    18391839  const media = JSON.stringify((note.images || []).map((u) => ({ url: u, type: 'image/jpeg' })));
    18401840  try {
    1841     tlStmts().ins.run(id, slug, note.actor_uri || '', note.actor_name || '', note.actor_handle || '',
     1841    const r = tlStmts().ins.run(id, slug, note.actor_uri || '', note.actor_name || '', note.actor_handle || '',
    18421842      note.actor_icon || '', note.actor_url || '', note.content || '', note.url || null,
    18431843      new Date().toISOString(), media, note.sensitive ? 1 : 0, note.cw || null);
     1844    if (!r.changes) {
     1845      // Row already cached (INSERT OR IGNORE) → refresh it with the freshly
     1846      // resolved note. Without this a row cached without its cover (or with
     1847      // stale content) stayed stale forever — even boosting again didn't heal it.
     1848      db.prepare('UPDATE ap_timeline SET content = ?, media_json = ?, nsfw = ?, cw = ?, url = COALESCE(?, url) WHERE slug = ? AND id = ?')
     1849        .run(note.content || '', media, note.sensitive ? 1 : 0, note.cw || null, note.url || null, slug, id);
     1850    }
    18441851  } catch { /* ignore */ }
    18451852  markBoosted(slug, id);
Note: See TracChangeset for help on using the changeset viewer.