simplified "followers" endpoint
This commit is contained in:
parent
7a7ea3350a
commit
5a74aa4a4d
2 changed files with 3 additions and 9 deletions
|
@ -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 ) {
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue