File tree Expand file tree Collapse file tree
src/middleware/packages/activitypub/services/activitypub/subservices Expand file tree Collapse file tree Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments