get_json_params(); if ( empty( $activity['type'] ) ) { return false; } if ( 'Create' !== $activity['type'] ) { return $valid; } if ( ! isset( $activity['object'] ) || ! \is_array( $activity['object'] ) ) { return false; } if ( ! isset( $activity['object']['id'], $activity['object']['content'] ) ) { return false; } return $valid; } /** * Remove a URL from the tombstone registry when a Create or Update activity is sent. * * This handles the case where a post was soft-deleted (visibility changed to local/private) * and then later changed back to public. The Create/Update activity indicates the post is being * re-federated, so we remove it from the tombstone registry. * * @param int $outbox_id The ID of the outbox activity. * @param \Activitypub\Activity\Activity $activity The Activity object. */ public static function maybe_unbury( $outbox_id, $activity ) { if ( ! in_array( $activity->get_type(), array( 'Create', 'Update' ), true ) ) { return; } $object = $activity->get_object(); if ( $object ) { Tombstone::remove( $object->get_id(), $object->get_url() ); } } }