]> 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:21:33 +0000 (15:21 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 28 Oct 2010 13:21:33 +0000 (15:21 +0200)
r/a=mkanat

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

index baca92bf0de30aed7165efc22d4a26b6e5c0e75d..7732d7d5fe20b44377f6ded39fde42a03a58ccc1 100644 (file)
@@ -1141,7 +1141,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,
@@ -1378,10 +1378,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 10f7cc49818952463468df8f4c91ca2d8a58357e..be1517c736377ce556c7eabf0772538e4ec2a52c 100644 (file)
@@ -1212,6 +1212,8 @@ sub match {
     my $user = Bugzilla->user;
     my $dbh = Bugzilla->dbh;
 
+    $str = trim($str);
+
     my @users = ();
     return \@users if $str =~ /^\s*$/;
 
@@ -1350,7 +1352,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};
@@ -1368,7 +1370,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};
@@ -1392,6 +1394,7 @@ sub match_field {
 
         my @logins;
         for my $query (@queries) {
+            $query = trim($query);
             my $users = match(
                 $query,   # match string
                 $limit,   # match limit
@@ -1656,7 +1659,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 7a5ffd3aad6efc111ce0a15df3f71ab844042939..0be16c3874f1ab5e49aa6f9809bd79414e3eea07 100644 (file)
@@ -710,7 +710,7 @@ YAHOO.bugzilla.userAutocomplete = {
         userAutoComp.useIFrame = true;
         userAutoComp.resultTypeList = false;
         if( multiple == true ){
-            userAutoComp.delimChar = [","," "];
+            userAutoComp.delimChar = [","];
         }
         
     }