diff --git a/app.psgi b/app.psgi index 7b1e27a0bc..49447de179 100644 --- a/app.psgi +++ b/app.psgi @@ -67,6 +67,7 @@ $app = Plack::Middleware::Assets->wrap( cpan toolbar github + contributors ) ], ); diff --git a/lib/MetaCPAN/Web/Controller/Release.pm b/lib/MetaCPAN/Web/Controller/Release.pm index 0ee2e85e2d..57d783a8b7 100644 --- a/lib/MetaCPAN/Web/Controller/Release.pm +++ b/lib/MetaCPAN/Web/Controller/Release.pm @@ -82,6 +82,9 @@ sub view : Private { $c->res->last_modified( $out->{date} ); + $self->groom_contributors( $c, $out ); + + # TODO: make took more automatic (to include all) $c->stash( { template => 'release.html', @@ -106,4 +109,36 @@ sub view : Private { ); } +# massage the x_contributors field into what we want +sub groom_contributors { + my( $self, $c, $out ) = @_; + + return unless $out->{metadata}{x_contributors}; + + # just in case a lonely contributor makes it as a scalar + $out->{metadata}{x_contributors} = [ + $out->{metadata}{x_contributors} + ] unless ref $out->{metadata}{x_contributors}; + + my @contributors = map { + s/<(.*)>//; + { name => $_, email => $1 } + } @{$out->{metadata}{x_contributors}}; + + $out->{metadata}{x_contributors} = \@contributors; + + for my $contributor ( @{ $out->{metadata}{x_contributors} } ) { + + # heuristic to autofill pause accounts + $contributor->{pauseid} = uc $1 + if !$contributor->{pauseid} + and $contributor->{email} =~ /^(.*)\@cpan.org/; + + next unless $contributor->{pauseid}; + + $contributor->{url} = + $c->uri_for_action( '/author/index', [ $contributor->{pauseid} ] ); + } +} + 1; diff --git a/root/inc/contributors.html b/root/inc/contributors.html new file mode 100644 index 0000000000..98251ee661 --- /dev/null +++ b/root/inc/contributors.html @@ -0,0 +1,25 @@ +<% IF contributors %> + +