Skip to content

Commit eb85c58

Browse files
committed
Merge branch 'master' into handle-selected-from-registry-data-grants
2 parents b29416d + b068f82 commit eb85c58

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

  • src/middleware/packages/activitypub/services/activitypub/subservices

src/middleware/packages/activitypub/services/activitypub/subservices/outbox.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,24 @@ const OutboxService = {
9696
webId: actorUri
9797
});
9898

99+
// -- Persist Activity --
100+
// There might be a capability attached which cannot be persisted, if it has a non-resolvable id.
101+
// So we won't persist it and re-attach it afterwards.
102+
let { capability, ...activityToPersist } = activity;
103+
99104
activityUri = await ctx.call('activitypub.activity.post', {
100105
containerUri: activitiesContainerUri,
101-
resource: activity,
106+
resource: activityToPersist,
102107
contentType: MIME_TYPES.JSON,
103108
webId: 'system' // Post as system since there is no write permission to the activities container
104109
});
105110

106-
activity = await ctx.call('activitypub.activity.get', { resourceUri: activityUri, webId: 'system' });
111+
// Refetch because persisting has side-effects.
112+
// And reattach capability for further processing (if present).
113+
activity = {
114+
...(await ctx.call('activitypub.activity.get', { resourceUri: activityUri, webId: 'system' })),
115+
capability
116+
};
107117
}
108118

109119
try {

0 commit comments

Comments
 (0)