Skip to content

Proposed patch for issue 3353 #3360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/MetaCPAN/Web/Controller/Release.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ sub view : Private {
$c->detach( '/internal_error', $error );
} )->get;

## Remove author from contributors list
my $author_name = $data->{author}->{name};
my $contributors = [];
foreach my $contributor ( @{ $data->{contributors} } ) {
if ( $contributor->{name} !~ /\b$author_name\b/ ) {
push @$contributors, $contributor;
}
}
$data->{contributors} = $contributors;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only applies to the release page. The Pod view would still include the extra contributors.

This filtering should probably happen in lib/MetaCPAN/Web/Model/API/Contributors.pm instead.

my $release = $data->{release};

$c->browser_max_age('1h');
Expand Down
2 changes: 1 addition & 1 deletion root/inc/contributors.tx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="nav-header">Authored by: <a href="/author/[% $release.author %]" class="cpan-author">[% $release.author %]</a></div>
%% if $contributors.size() {
<div>
<button class="contributors-show-button btn-link">and [% $contributors.size() %] contributors</button>
<button class="contributors-show-button btn-link">and [% $contributors.size() %] [% $contributors.size() > 1 ? 'contributors' : 'contributor' %]</button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be done with the pluralize function.

<div id="metacpan_contributors" class="slide-out slide-out-hidden">
<div>
<ul>
Expand Down
Loading