@rmdes/indiekit-endpoint-activitypub 2.0.11 → 2.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -480,7 +480,7 @@ export default class ActivityPubEndpoint {
480
480
  type: typeName,
481
481
  actorUrl: self._publicationUrl,
482
482
  objectUrl: properties.url,
483
- targetUrl: replyToActor?.url || undefined,
483
+ targetUrl: properties["in-reply-to"] || undefined,
484
484
  summary: `Sent ${typeName} for ${properties.url} to ${followerCount} followers${replyNote}`,
485
485
  });
486
486
 
@@ -137,41 +137,30 @@ export function myProfileController(plugin) {
137
137
  }
138
138
 
139
139
  case "replies": {
140
- const apActivities = collections.get("ap_activities");
141
- if (apActivities) {
140
+ // Query posts collection for reply-type posts (have in-reply-to)
141
+ if (postsCollection) {
142
142
  const query = {
143
- direction: "outbound",
144
- type: "Create",
145
- targetUrl: { $exists: true, $ne: null },
143
+ "properties.post-type": "reply",
146
144
  };
147
145
  if (before) {
148
- query.receivedAt = { $lt: before };
146
+ query["properties.published"] = { $lt: before };
149
147
  }
150
148
 
151
- const activities = await apActivities
149
+ const replies = await postsCollection
152
150
  .find(query)
153
- .sort({ receivedAt: -1 })
151
+ .sort({ "properties.published": -1 })
154
152
  .limit(PAGE_LIMIT)
155
153
  .toArray();
156
154
 
157
- items = activities.map((a) => ({
158
- uid: a.objectUrl,
159
- url: a.objectUrl,
160
- content: a.content
161
- ? { text: a.content }
162
- : { text: a.summary || "" },
163
- published: a.receivedAt,
164
- inReplyTo: a.targetUrl,
165
- type: "reply",
166
- author: {
167
- name: profile?.name || a.actorName || "",
168
- url: profile?.url || a.actorUrl || "",
169
- photo: profile?.icon || "",
170
- },
171
- }));
172
-
173
- if (activities.length === PAGE_LIMIT) {
174
- nextBefore = activities[activities.length - 1].receivedAt;
155
+ items = replies.map((p) => {
156
+ const card = postToCardItem(p, profile);
157
+ card.inReplyTo = p.properties?.["in-reply-to"] || null;
158
+ card.type = "reply";
159
+ return card;
160
+ });
161
+
162
+ if (replies.length === PAGE_LIMIT) {
163
+ nextBefore = items[items.length - 1].published;
175
164
  }
176
165
  }
177
166
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "2.0.11",
3
+ "version": "2.0.12",
4
4
  "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
5
5
  "keywords": [
6
6
  "indiekit",