@@ -24,7 +24,9 @@ public static function init() {
24
24
\add_action ( 'activitypub_inbox_delete ' , array ( self ::class, 'handle_delete ' ) );
25
25
\add_filter ( 'activitypub_defer_signature_verification ' , array ( self ::class, 'defer_signature_verification ' ), 10 , 2 );
26
26
\add_action ( 'activitypub_delete_actor_interactions ' , array ( self ::class, 'delete_interactions ' ) );
27
+
27
28
\add_filter ( 'activitypub_get_outbox_activity ' , array ( self ::class, 'outbox_activity ' ) );
29
+ \add_action ( 'post_activitypub_add_to_outbox ' , array ( self ::class, 'post_add_to_outbox ' ), 10 , 2 );
28
30
}
29
31
30
32
/**
@@ -182,6 +184,7 @@ public static function defer_signature_verification( $defer, $request ) {
182
184
* Set the object to the object ID.
183
185
*
184
186
* @param \Activitypub\Activity\Activity $activity The Activity object.
187
+ *
185
188
* @return \Activitypub\Activity\Activity The filtered Activity object.
186
189
*/
187
190
public static function outbox_activity ( $ activity ) {
@@ -191,4 +194,17 @@ public static function outbox_activity( $activity ) {
191
194
192
195
return $ activity ;
193
196
}
197
+
198
+ /**
199
+ * Add the activity to the outbox.
200
+ *
201
+ * @param int $outbox_id The ID of the outbox activity.
202
+ * @param \Activitypub\Activity\Activity $activity The Activity object.
203
+ */
204
+ public static function post_add_to_outbox ( $ outbox_id , $ activity ) {
205
+ // Set Tombstones for deleted objects.
206
+ if ( 'Delete ' === $ activity ->get_type () ) {
207
+ Tombstone::bury ( object_to_uri ( $ activity ->get_object () ) );
208
+ }
209
+ }
194
210
}
0 commit comments