Skip to content

Commit e724599

Browse files
committed
Contributor: check emails against authors data
1 parent 344f1e0 commit e724599

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/MetaCPAN/Query/Release.pm

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,26 @@ sub get_contributors {
172172
@{ $contrib->{email} };
173173
$contrib->{pauseid} = uc $pauseid
174174
if $pauseid;
175+
176+
}
177+
178+
# check if contributor's email points to a registered author
179+
if ( !$contrib->{pauseid} ) {
180+
for my $email ( @{ $contrib->{email} } ) {
181+
my $check_author = $self->es->search(
182+
index => $self->index_name,
183+
type => 'author',
184+
body => {
185+
query => { term => { email => $email } },
186+
size => 10,
187+
}
188+
);
189+
190+
if ( $check_author->{hits}{total} ) {
191+
$contrib->{pauseid}
192+
= uc $check_author->{hits}{hits}[0]{_source}{pauseid};
193+
}
194+
}
175195
}
176196
}
177197

0 commit comments

Comments
 (0)