From a6041007c544e7b2a8ae703c8e45e635e2ace991 Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Thu, 28 Oct 2010 15:19:51 +0200 Subject: Bug 585802: Change the cc/user autocomplete (and backend) usermatching to ignore spaces / search on space separated names r/a=mkanat --- Bugzilla/User.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Bugzilla/User.pm') diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index bf0a9e7e9..de2d0dcc7 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -1222,6 +1222,8 @@ sub match { my $user = Bugzilla->user; my $dbh = Bugzilla->dbh; + $str = trim($str); + my @users = (); return \@users if $str =~ /^\s*$/; @@ -1360,7 +1362,7 @@ sub match_field { #Concatenate login names, so that we have a common way to handle them. my $raw_field; if (ref $data->{$field}) { - $raw_field = join(" ", @{$data->{$field}}); + $raw_field = join(",", @{$data->{$field}}); } else { $raw_field = $data->{$field}; @@ -1378,7 +1380,7 @@ sub match_field { $data->{$field} = ''; } elsif ($fields->{$field}->{'type'} eq 'multi') { - @queries = split(/[\s,;]+/, $raw_field); + @queries = split(/[,;]+/, $raw_field); # We will repopulate it later if a match is found, else it must # be undefined. delete $data->{$field}; @@ -1402,6 +1404,7 @@ sub match_field { my @logins; for my $query (@queries) { + $query = trim($query); my $users = match( $query, # match string $limit, # match limit @@ -1653,7 +1656,7 @@ sub is_global_watcher { my $self = shift; if (!defined $self->{'is_global_watcher'}) { - my @watchers = split(/[,\s]+/, Bugzilla->params->{'globalwatchers'}); + my @watchers = split(/[,;]+/, Bugzilla->params->{'globalwatchers'}); $self->{'is_global_watcher'} = scalar(grep { $_ eq $self->login } @watchers) ? 1 : 0; } return $self->{'is_global_watcher'}; -- cgit v1.2.3-24-g4f1b