simplified "followers" endpoint

This commit is contained in:
Matthias Pfefferle 2019-03-12 22:19:51 +01:00
parent 7a7ea3350a
commit 5a74aa4a4d
2 changed files with 3 additions and 9 deletions

View file

@ -12,7 +12,7 @@ class Followers {
$followers = get_user_option( 'activitypub_followers', $author_id ); $followers = get_user_option( 'activitypub_followers', $author_id );
if ( ! $followers ) { if ( ! $followers ) {
return $followers; return array();
} }
foreach ( $followers as $key => $follower ) { foreach ( $followers as $key => $follower ) {

View file

@ -62,15 +62,9 @@ class Followers {
$json->{'@context'} = \Activitypub\get_context(); $json->{'@context'} = \Activitypub\get_context();
$followers = \Activitypub\Db\Followers::get_followers( $user_id );
if ( ! is_array( $followers ) ) {
$followers = array();
}
$json->partOf = get_rest_url( null, "/activitypub/1.0/users/$user_id/followers" ); // phpcs:ignore $json->partOf = get_rest_url( null, "/activitypub/1.0/users/$user_id/followers" ); // phpcs:ignore
$json->totalItems = count( $followers ); // phpcs:ignore $json->totalItems = \Activitypub\count_followers( $user_id ); // phpcs:ignore
$json->orderedItems = $followers; // phpcs:ignore $json->orderedItems = \Activitypub\Db\Followers::get_followers( $user_id ); // phpcs:ignore
$json->first = $json->partOf; // phpcs:ignore $json->first = $json->partOf; // phpcs:ignore