Changeset 8b700ad in Klonkt


Ignore:
Timestamp:
06/30/2026 01:38:10 PM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
d8e3ff7
Parents:
462a931
Message:

fix(federation): refresh ap_timeline.url on inbound Update (remote slug rename kept a dead link)

A remote post's AP id is stable across a slug rename, but its human url changes. The inbound
Update handler refreshed content/media but not url, so a renamed remote post kept linking to the
old, now-404 URL. Now COALESCE the new url in. (like/boost key on the stable AP id and are
unaffected by the rename.)

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r462a931 r8b700ad  
    829829      const media = mediaFromNote(o);
    830830      try {
    831         const r = db.prepare('UPDATE ap_timeline SET content = ?, media_json = ?, nsfw = ?, cw = ? WHERE id = ? AND author_uri = ?')
    832           .run(html, media, o.sensitive ? 1 : 0, o.summary || null, o.id, claimedActor);
     831        // Refresh url too (COALESCE keeps the old one if the Update omits it): a remote slug
     832        // rename keeps the same AP id but changes the human url, so without this the cached
     833        // post would keep linking to the old, now-dead URL.
     834        const r = db.prepare('UPDATE ap_timeline SET content = ?, media_json = ?, nsfw = ?, cw = ?, url = COALESCE(?, url) WHERE id = ? AND author_uri = ?')
     835          .run(html, media, o.sensitive ? 1 : 0, o.summary || null, o.url || null, o.id, claimedActor);
    833836        if (r.changes) console.log('[AP] timeline update', claimedActor, '→', o.id);
    834837      } catch { /* ignore */ }
Note: See TracChangeset for help on using the changeset viewer.