Changeset de3d24b in Klonkt


Ignore:
Timestamp:
06/24/2026 01:53:00 PM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
ffa53cc
Parents:
7c44c12
Message:

fix(activitypub): link owner's remote-reply to the local post so it shows

resolveRemoteNote now resolves the local post (findThreadTarget on the note id);
the authorize_interaction flow stores the owner's reply with that post_id, so a
reply to a comment on your own post appears nested in the thread.

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

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/routes/posts.js

    r7c44c12 rde3d24b  
    538538    // Resolve + deliver in the background so Send responds instantly.
    539539    ActivityPubService.resolveRemoteNote(uri)
    540       .then((parent) => parent && ActivityPubService.deliverReply(site, { postId: '', postSlug: null, parent, text }))
     540      .then((parent) => parent && ActivityPubService.deliverReply(site, { postId: parent.localPostId || '', postSlug: null, parent, text }))
    541541      .catch((e) => console.warn('[AP] remote reply failed:', e.message));
    542542  }
  • src/services/ActivityPubService.js

    r7c44c12 rde3d24b  
    537537  const actor = await fetchActor(actorUri).catch(() => null);
    538538  const ai = actorInfo(actor, actorUri);
     539  // Is what we're replying to a post (or a comment) on one of OUR posts? If so,
     540  // link our reply to that local post so it shows nested in the post thread.
     541  const localTgt = findThreadTarget(note.id, (process.env.PUBLIC_BASE_URL || '').replace(/\/+$/, ''));
    539542  // If this note is itself a reply (a comment), also reach the original post's
    540543  // author so THEIR server threads our reply under the comment.
     
    564567    images,
    565568    threadInbox,                                            // post author's inbox (if a comment)
     569    localPostId: localTgt ? localTgt.post_id : '',          // our post this belongs to (if any)
    566570    preview: HtmlSanitizerService.toPlainText(note.content || '').slice(0, 240),
    567571  };
Note: See TracChangeset for help on using the changeset viewer.