Changeset 55bba23 in Klonkt for src/routes/posts.js


Ignore:
Timestamp:
06/25/2026 09:13:53 AM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
4b5223f
Parents:
f9f3312
Message:

fediverse: federate pin order via Add/Remove activities (reliable, push-based)

The featured COLLECTION is pull-based and Mastodon caches it with sticky StatusPins, so
reordering never propagated. Mastodon federates pins via Add/Remove activities to the
featured collection (Add -> StatusPin.create, Remove -> destroy), processed immediately.
resyncFeaturedPins removes every pin then re-adds in rank-DESC order (rank 1 last =
newest = shown first) with gaps. /save fires it on any pin/unpin/reorder. Replaces the
unreliable deliverActorUpdate(featured-refetch) approach.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/posts.js

    rf9f3312 r55bba23  
    367367  }
    368368
    369   // Pin/unpin changed → push an actor Update so Mastodon re-fetches the featured
    370   // (pinned) collection promptly instead of waiting for its own actor refresh.
     369  // Pin/unpin/reorder → push Add/Remove activities so followers' instances update the
     370  // pinned order immediately (reliable, unlike re-fetching the cached featured collection).
    371371  if ((post.pinned || 0) !== parsePinnedRank(pinned)) {
    372     ActivityPubService.deliverActorUpdate(site).catch(() => { /* best-effort */ });
     372    const unpinned = (post.pinned || 0) > 0 && parsePinnedRank(pinned) === 0 ? [post.id] : [];
     373    ActivityPubService.resyncFeaturedPins(site, unpinned).catch(() => { /* best-effort */ });
    373374  }
    374375
Note: See TracChangeset for help on using the changeset viewer.