better add_follower handling

This commit is contained in:
Matthias Pfefferle 2023-06-19 11:04:45 +02:00
parent 28922d51dd
commit 08e3104a1e

View file

@ -217,9 +217,12 @@ class Followers {
$follower->from_meta( $meta );
$follower->upsert();
update_post_meta( $follower->get_id(), 'user_id', $user_id, $user_id );
$meta = get_post_meta( $follower->get_id(), 'user_id' );
if ( is_array( $meta ) && ! in_array( $user_id, $meta, true ) ) {
add_post_meta( $follower->get_id(), 'user_id', $user_id );
wp_cache_delete( sprintf( self::CACHE_KEY_INBOXES, $user_id ), 'activitypub' );
}
return $follower;
}