]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 585802: Change the cc/user autocomplete (and backend) usermatching to ignore...
authorChristian Legnitto <clegnitto@mozilla.com>
Thu, 28 Oct 2010 13:19:51 +0000 (15:19 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 28 Oct 2010 13:19:51 +0000 (15:19 +0200)
r/a=mkanat

Bugzilla/Bug.pm
Bugzilla/User.pm
js/field.js

index 026244db9d2870b18ad6ef6f718e9948c4a65860..abc00c298f8af64f6fb058601989ebcd3366f683 100644 (file)
@@ -1134,7 +1134,7 @@ sub send_changes {
                   ? $changes->{cc}->[0] : '';
 
     my %forced = (
-        cc        => [split(/[\s,]+/, $old_cc)],
+        cc        => [split(/[,;]+/, $old_cc)],
         owner     => $old_own,
         qacontact => $old_qa,
         changer   => $user,
@@ -1384,10 +1384,11 @@ sub _check_cc {
     return [map {$_->id} @{$component->initial_cc}] unless $ccs;
 
     # Allow comma-separated input as well as arrayrefs.
-    $ccs = [split(/[\s,]+/, $ccs)] if !ref $ccs;
+    $ccs = [split(/[,;]+/, $ccs)] if !ref $ccs;
 
     my %cc_ids;
     foreach my $person (@$ccs) {
+        $person = trim($person);
         next unless $person;
         my $id = login_to_id($person, THROW_ERROR);
         $cc_ids{$id} = 1;
index bf0a9e7e929ace9a40e39cf8659363fb057f97b3..de2d0dcc746724d219fe7e8ee2e60a4e1f71f74f 100644 (file)
@@ -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'};
index a70e41a649ccc3e3b4fcb819fb1c3747fd3e5ba6..6d78a60ce04990c1f58141bf6fef649f53f35737 100644 (file)
@@ -724,7 +724,7 @@ YAHOO.bugzilla.userAutocomplete = {
         userAutoComp.useIFrame = true;
         userAutoComp.resultTypeList = false;
         if( multiple == true ){
-            userAutoComp.delimChar = [","," "];
+            userAutoComp.delimChar = [","];
         }
         
     }