Don't choke if there an object with an empty APID already in the db
This commit is contained in:
parent
a364322c77
commit
0881890b41
@ -74,7 +74,7 @@ function post_to_object( $post ) {
|
||||
);
|
||||
$existing = \pterotype\objects\get_object_by_url( $permalink );
|
||||
if ( $existing ) {
|
||||
$object['id'] = $existing->activitypub_id;
|
||||
$object['id'] = $existing['id'];
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ function create_local_object( $object ) {
|
||||
}
|
||||
$object = compact_object( $object );
|
||||
$res = $wpdb->insert( $wpdb->prefix . 'pterotype_objects', array(
|
||||
'object' => wp_json_encode( $object )
|
||||
'object' => wp_json_encode( $object ),
|
||||
'activitypub_id' => "uninitialized_" . rand(),
|
||||
) );
|
||||
if ( !$res ) {
|
||||
return new \WP_Error(
|
||||
|
Loading…
Reference in New Issue
Block a user