Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1872 from metacpan/mickey/releaseinfo_bug_fix
releaseinfo bug fix
  • Loading branch information
oalders committed Apr 26, 2017
2 parents 7f6319e + 285211b commit 8daecc2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions lib/MetaCPAN/Web/Model/ReleaseInfo.pm
Expand Up @@ -11,6 +11,8 @@ use MetaCPAN::Web::Types qw( HashRef Object );
use URI;
use URI::Escape qw(uri_escape uri_unescape);
use URI::QueryParam; # Add methods to URI.
use Importer 'MetaCPAN::Web::Elasticsearch::Adapter' =>
qw/ single_valued_arrayref_to_scalar /;

sub ACCEPT_CONTEXT {
my ( $class, $c, $args ) = @_;
Expand Down Expand Up @@ -63,7 +65,9 @@ sub summary_hash {
# massage the x_contributors field into what we want
sub groom_contributors {
my ($self) = @_;
my ( $release, $author ) = ( $self->release, $self->author );
my ( $release, $author )
= ( $self->release,
single_valued_arrayref_to_scalar( $self->author ) );

my $contribs = $release->{metadata}{x_contributors} || [];
my $authors = $release->{metadata}{author} || [];
Expand All @@ -82,11 +86,8 @@ sub groom_contributors {
$authors = [ grep { $_ ne 'unknown' } @$authors ];

my $author_info = {
email => [
lc "$release->{author}\@cpan.org",
@{ $author->{email} || [] },
],
name => $author->{name},
email => [ lc "$release->{author}\@cpan.org", $author->{email} ],
name => $author->{name},
};
my %seen = map { $_ => $author_info }
( @{ $author_info->{email} }, $author_info->{name}, );
Expand Down
3 changes: 2 additions & 1 deletion t/controller/shared/release-info.t
Expand Up @@ -58,7 +58,8 @@ test_psgi app, sub {
module => 'LWP::UserAgent',
release => 'libwww-perl',
repository => 0,
home_page => 0
home_page => 0,
issues => 'https://github.com/libwww-perl/libwww-perl/issues',
},

# no optional tests
Expand Down

0 comments on commit 8daecc2

Please sign in to comment.