Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Followers endpoint to extend WP_REST_Controller #1266

Merged
merged 10 commits into from
Feb 5, 2025

Conversation

obenland
Copy link
Member

@obenland obenland commented Feb 4, 2025

Follow-up to #1146.

Proposed changes:

  • Updates Followers endpoint to extend WP_REST_Controller.
  • Adds unit tests and schema information for Followers endpoint.

Other information:

  • Have you written new tests for your changes, if applicable?

@obenland obenland added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Feb 4, 2025
@obenland obenland requested a review from pfefferle February 4, 2025 14:27
@obenland obenland self-assigned this Feb 4, 2025
}

$response['first'] = \add_query_arg( 'page', 1, $response['partOf'] );
$response['last'] = \add_query_arg( 'page', \ceil( $response['totalItems'] / $per_page ), $response['partOf'] );
Copy link
Member

@pfefferle pfefferle Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by default (no followers) it shows 0 and loading that page throws an error then. either this should link to min 1 or only show up if $data has more than one page.

@pfefferle
Copy link
Member

Now the pages 2 and above will show no errors. Is that fine?

pfefferle
pfefferle previously approved these changes Feb 5, 2025
@obenland
Copy link
Member Author

obenland commented Feb 5, 2025

Could you describe the scenario where you'd expect an error? I'm not quite following

@pfefferle
Copy link
Member

oh sorry! if you have only one page and change the page number in the URL to a way higher page. should we show an error then or simply show an empty items array?

@obenland
Copy link
Member Author

obenland commented Feb 5, 2025

Oh! Core's Posts controller accounts for that, I opted not to bother in the Outbox controller, but happy to reconsider!

@pfefferle
Copy link
Member

I am fine with both... just wanted to bring up the question...

@obenland obenland merged commit a3ff833 into trunk Feb 5, 2025
11 checks passed
@obenland obenland deleted the update/followers-endpoint branch February 5, 2025 12:15
Menrath pushed a commit to Menrath/wordpress-activitypub that referenced this pull request Feb 6, 2025
* Move file

* Update followers endpoint to extend WP_REST_Controlelr

* Inherit from Actors_Controller

* update schema

* Remove debug

* Adopt pagination from Outbox Controller

Props @pfefferle

* Prevent requests that go beyond what's available

Props @pfefferle

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants