Commit 663c65a3 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 543500: Cannot add/edit components anymore (regression in user matching)

r/a=mkanat
parent b0642d67
...@@ -1197,25 +1197,21 @@ sub match_field { ...@@ -1197,25 +1197,21 @@ sub match_field {
} }
$raw_field = clean_text($raw_field || ''); $raw_field = clean_text($raw_field || '');
# Tolerate fields that do not exist (in case you specify
# e.g. the QA contact, and it's currently not in use).
next unless ($raw_field && $raw_field ne '');
my @queries = ();
# Now we either split $raw_field by spaces/commas and put the list # Now we either split $raw_field by spaces/commas and put the list
# into @queries, or in the case of fields which only accept single # into @queries, or in the case of fields which only accept single
# entries, we simply use the verbatim text. # entries, we simply use the verbatim text.
my @queries;
# single field
if ($fields->{$field}->{'type'} eq 'single') { if ($fields->{$field}->{'type'} eq 'single') {
@queries = ($raw_field); @queries = ($raw_field);
# We will repopulate it later if a match is found, else it must
# multi-field # be set to an empty string so that the field remains defined.
$data->{$field} = '';
} }
elsif ($fields->{$field}->{'type'} eq 'multi') { elsif ($fields->{$field}->{'type'} eq 'multi') {
@queries = split(/[\s,;]+/, $raw_field); @queries = split(/[\s,;]+/, $raw_field);
# We will repopulate it later if a match is found, else it must
# be undefined.
delete $data->{$field};
} }
else { else {
# bad argument # bad argument
...@@ -1225,6 +1221,10 @@ sub match_field { ...@@ -1225,6 +1221,10 @@ sub match_field {
}); });
} }
# Tolerate fields that do not exist (in case you specify
# e.g. the QA contact, and it's currently not in use).
next unless (defined $raw_field && $raw_field ne '');
my $limit = 0; my $limit = 0;
if ($params->{'maxusermatches'}) { if ($params->{'maxusermatches'}) {
$limit = $params->{'maxusermatches'} + 1; $limit = $params->{'maxusermatches'} + 1;
...@@ -1284,7 +1284,7 @@ sub match_field { ...@@ -1284,7 +1284,7 @@ sub match_field {
if ($fields->{$field}->{'type'} eq 'single') { if ($fields->{$field}->{'type'} eq 'single') {
$data->{$field} = $logins[0] || ''; $data->{$field} = $logins[0] || '';
} }
else { elsif (scalar @logins) {
$data->{$field} = \@logins; $data->{$field} = \@logins;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment