Skip to content

Commit

Permalink
Relay the exclude_replies parameter to filters
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed May 14, 2024
1 parent 76197a4 commit cc5f3b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions includes/class-mastodon-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -2246,7 +2246,8 @@ public function api_account_statuses( $request ) {
$user_id = $this->get_user_id_from_request( $request );

$args = array(
'author' => $user_id,
'author' => $user_id,
'exclude_replies' => $request->get_param( 'exclude_replies' ),
);
$args = apply_filters( 'mastodon_api_account_statuses_args', $args, $request );

Expand Down Expand Up @@ -2290,7 +2291,6 @@ public function api_account( $request ) {
* ```
*/
$account = \apply_filters( 'mastodon_api_account', null, $user_id, $request, null );

return $this->validate_entity( $account, Entity\Account::class );
}

Expand Down
6 changes: 6 additions & 0 deletions includes/handler/class-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ protected function get_posts( $args, $min_id = null, $max_id = null ): \WP_REST_
continue;
}

if ( $args['exclude_replies'] ) {
if ( $status->in_reply_to_id ) {
continue;
}
}

if ( ! $status->is_valid() ) {
error_log( wp_json_encode( compact( 'status', 'post' ) ) );
continue;
Expand Down

0 comments on commit cc5f3b1

Please sign in to comment.