Skip to content

Commit

Permalink
release/by_author: support 'page' parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyn committed Sep 3, 2023
1 parent 88260ad commit 620c151
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/MetaCPAN/Query/Release.pm
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,9 @@ sub by_author_and_names {
}

sub by_author {
my ( $self, $pauseid, $size ) = @_;
my ( $self, $pauseid, $size, $page ) = @_;
$size //= 1000;
$page //= 1;

my $body = {
query => {
Expand All @@ -444,6 +445,7 @@ sub by_author {
qw( abstract author authorized date distribution license metadata.version resources.repository status tests )
],
size => $size,
from => ( $page - 1 ) * $size,
};

my $ret = $self->es->search(
Expand Down
4 changes: 2 additions & 2 deletions lib/MetaCPAN/Server/Controller/Release.pm
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ sub recent : Path('recent') : Args(0) {

sub by_author : Path('by_author') : Args(1) {
my ( $self, $c, $pauseid ) = @_;
$c->stash_or_detach(
$self->model($c)->by_author( $pauseid, $c->req->param('size') ) );
$c->stash_or_detach( $self->model($c)
->by_author( $pauseid, @{ $c->req->params }{qw( size page )} ) );
}

sub latest_by_distribution : Path('latest_by_distribution') : Args(1) {
Expand Down

0 comments on commit 620c151

Please sign in to comment.