Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Proposed patch for issue 3353
    1) Remove author from contributors list
    2) Use plural form only if more than one contributors
  • Loading branch information
manwar committed May 23, 2025
commit 1647d0ae62044bd1d493897b5980a92f5a2c613a
10 changes: 10 additions & 0 deletions lib/MetaCPAN/Web/Controller/Release.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package MetaCPAN::Web::Controller::Release;

Check failure on line 1 in lib/MetaCPAN/Web/Controller/Release.pm

View workflow job for this annotation

GitHub Actions / Code Formatting

Linting with perltidy failed

use Moose;
use experimental 'postderef';
Expand Down Expand Up @@ -63,6 +63,16 @@
$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