From 9805cb9eff166624a4471d6bafd100e042e207eb Mon Sep 17 00:00:00 2001 From: Ricardo Date: Mon, 23 Feb 2026 16:29:32 +0100 Subject: [PATCH] fix: my-profile replies tab queries posts collection instead of ap_activities The replies tab was empty because it queried ap_activities for outbound Create activities with a non-null targetUrl, but targetUrl was always null (remote actor resolution often fails). Now queries posts collection for post-type "reply" which reliably has in-reply-to URLs. Also fixes activity log to store in-reply-to URL as targetUrl instead of the resolved actor URL. --- index.js | 2 +- lib/controllers/my-profile.js | 39 +++++++++++++---------------------- package.json | 2 +- 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/index.js b/index.js index 34d0b8e..293aa3e 100644 --- a/index.js +++ b/index.js @@ -480,7 +480,7 @@ export default class ActivityPubEndpoint { type: typeName, actorUrl: self._publicationUrl, objectUrl: properties.url, - targetUrl: replyToActor?.url || undefined, + targetUrl: properties["in-reply-to"] || undefined, summary: `Sent ${typeName} for ${properties.url} to ${followerCount} followers${replyNote}`, }); diff --git a/lib/controllers/my-profile.js b/lib/controllers/my-profile.js index 1e9e384..7ac9ec5 100644 --- a/lib/controllers/my-profile.js +++ b/lib/controllers/my-profile.js @@ -137,41 +137,30 @@ export function myProfileController(plugin) { } case "replies": { - const apActivities = collections.get("ap_activities"); - if (apActivities) { + // Query posts collection for reply-type posts (have in-reply-to) + if (postsCollection) { const query = { - direction: "outbound", - type: "Create", - targetUrl: { $exists: true, $ne: null }, + "properties.post-type": "reply", }; if (before) { - query.receivedAt = { $lt: before }; + query["properties.published"] = { $lt: before }; } - const activities = await apActivities + const replies = await postsCollection .find(query) - .sort({ receivedAt: -1 }) + .sort({ "properties.published": -1 }) .limit(PAGE_LIMIT) .toArray(); - items = activities.map((a) => ({ - uid: a.objectUrl, - url: a.objectUrl, - content: a.content - ? { text: a.content } - : { text: a.summary || "" }, - published: a.receivedAt, - inReplyTo: a.targetUrl, - type: "reply", - author: { - name: profile?.name || a.actorName || "", - url: profile?.url || a.actorUrl || "", - photo: profile?.icon || "", - }, - })); + items = replies.map((p) => { + const card = postToCardItem(p, profile); + card.inReplyTo = p.properties?.["in-reply-to"] || null; + card.type = "reply"; + return card; + }); - if (activities.length === PAGE_LIMIT) { - nextBefore = activities[activities.length - 1].receivedAt; + if (replies.length === PAGE_LIMIT) { + nextBefore = items[items.length - 1].published; } } break; diff --git a/package.json b/package.json index d3faa79..810b052 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rmdes/indiekit-endpoint-activitypub", - "version": "2.0.11", + "version": "2.0.12", "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.", "keywords": [ "indiekit",