Skip to content

Commit 1647d0a

Browse files
committed
Proposed patch for issue 3353
1) Remove author from contributors list 2) Use plural form only if more than one contributors
1 parent dd7274a commit 1647d0a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/MetaCPAN/Web/Controller/Release.pm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ sub view : Private {
6363
$c->detach( '/internal_error', $error );
6464
} )->get;
6565

66+
## Remove author from contributors list
67+
my $author_name = $data->{author}->{name};
68+
my $contributors = [];
69+
foreach my $contributor (@{$data->{contributors}}) {
70+
if ($contributor->{name} !~ /\b$author_name\b/) {
71+
push @$contributors, $contributor;
72+
}
73+
}
74+
$data->{contributors} = $contributors;
75+
6676
my $release = $data->{release};
6777

6878
$c->browser_max_age('1h');

root/inc/contributors.tx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="nav-header">Authored by: <a href="/author/[% $release.author %]" class="cpan-author">[% $release.author %]</a></div>
22
%% if $contributors.size() {
33
<div>
4-
<button class="contributors-show-button btn-link">and [% $contributors.size() %] contributors</button>
4+
<button class="contributors-show-button btn-link">and [% $contributors.size() %] [% $contributors.size() > 1 ? 'contributors' : 'contributor' %]</button>
55
<div id="metacpan_contributors" class="slide-out slide-out-hidden">
66
<div>
77
<ul>

0 commit comments

Comments
 (0)