Changeset 4c70ecb in Klonkt


Ignore:
Timestamp:
07/21/2026 11:44:49 PM (7 weeks ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
8b07c12
Parents:
fb30b5d
Message:

C2S Block and Undo(Block): Shaer's Orbit becomes a real server block

Putting someone "in Orbit" in Shaer was client-side only. The C2S outbox
now accepts Block and Undo(Block), wired onto the same blockTarget/unblock
the web UI uses: the actor lands in ap_blocks, shows up in the Block tab,
and their cached content is purged. Releasing from Orbit undoes it.

Changed files:
src/services/ActivityPubService.js

  • ingestOutboxActivity: case 'Block' -> blockTarget(site, uri), 202
  • Undo with inner Block -> unblock(site, uri), 202

New file:
test/c2s-block.test.js

  • Block lands in ap_blocks, Undo releases, missing object is 400

Changed files:
test/c2s-outbox.test.js

  • the unsupported-Undo example was Block; that is real now, the test uses Move instead

151 tests, all green.

-robo
Co-Authored-By: Claude Opus 4.8 <noreply@…>

Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    rfb30b5d r4c70ecb  
    19651965        return { status: 202, url: actorUri };
    19661966      }
     1967      // Shaer "in Orbit" = a real Block (FEP-c648 client side): lands in
     1968      // ap_blocks, shows in the Block tab, and purges the actor's cached
     1969      // content. Client-side filtering becomes a cache of this state.
     1970      case 'Block': {
     1971        const targetUri = c2sIdOf(object);
     1972        if (!targetUri) return { status: 400, error: 'missing_object' };
     1973        const r = await blockTarget(site, targetUri);
     1974        if (r && r.error) return { status: 400, error: r.error };
     1975        return { status: 202, url: targetUri };
     1976      }
    19671977      case 'Undo': {
    19681978        const inner = object && typeof object === 'object' ? object : null;
     
    19711981        const innerTarget = c2sIdOf(inner && inner.object);
    19721982        if (innerType === 'Follow') { await unfollowActor(site, innerTarget); return { status: 202, url: innerTarget }; }
     1983        if (innerType === 'Block') {
     1984          if (!innerTarget) return { status: 400, error: 'missing_object' };
     1985          unblock(site, innerTarget);   // release from Orbit
     1986          return { status: 202, url: innerTarget };
     1987        }
    19731988        if (innerType === 'Like' || innerType === 'Announce') {
    19741989          const kind = innerType === 'Announce' ? 'unboost' : 'unlike';
  • test/c2s-outbox.test.js

    rfb30b5d r4c70ecb  
    6767
    6868test('Undo of an unknown inner type → 400', async () => {
    69   const out = await AP.ingestOutboxActivity(site, user, { type: 'Undo', object: { type: 'Block', object: 'x' } });
     69  // Block used to be the unsupported example; it is real now (c2s-block.test).
     70  const out = await AP.ingestOutboxActivity(site, user, { type: 'Undo', object: { type: 'Move', object: 'x' } });
    7071  assert.equal(out.status, 400);
    7172  assert.equal(out.error, 'unsupported_undo');
Note: See TracChangeset for help on using the changeset viewer.