Fix for bug 179494: prevents Bugzilla from thinking users have changed flags when they haven't.

r=bbaetz
a=myk
This commit is contained in:
myk%mozilla.org 2002-11-17 12:46:00 +00:00
parent 6c6084e735
commit 67ac41f3d2
2 changed files with 30 additions and 13 deletions

View File

@ -312,11 +312,21 @@ sub modify {
my $flag = get($id); my $flag = get($id);
my $status = $data->{"flag-$id"}; my $status = $data->{"flag-$id"};
my $requestee_email = $data->{"requestee-$id"}; my $requestee_email = &::trim($data->{"requestee-$id"});
# Ignore flags the user didn't change. # Ignore flags the user didn't change. A flag hasn't changed
next if ($status eq $flag->{'status'} && $flag->{'requestee'} # if its status and requestee remain the same. Status is easy;
&& $requestee_email eq $flag->{'requestee'}->{'email'}); # we just compare the existing status with the submitted one.
# For requestee, however, we have to be careful not to compare
# the two if the flag isn't specifically requestable or isn't
# being requested, otherwise we'll get false positives and think
# the user changed the flag when they didn't.
next if
$status eq $flag->{'status'} # the flag's status hasn't changed, and
&& (!$flag->{'is_requesteeble'} # the flag isn't specifically requestable, or
|| $status ne "?" # the flag isn't being requested, or
|| ($flag->{'requestee'} # the requestee hasn't changed
&& ($requestee_email eq $flag->{'requestee'}->{'email'})));
# Since the status is validated, we know it's safe, but it's still # Since the status is validated, we know it's safe, but it's still
# tainted, so we have to detaint it before using it in a query. # tainted, so we have to detaint it before using it in a query.

View File

@ -314,8 +314,12 @@ sub match_field {
if ((scalar(@{$users}) == 1) if ((scalar(@{$users}) == 1)
&& (@{$users}[0]->{'email'} eq $query)) && (@{$users}[0]->{'email'} eq $query))
{ {
$vars->{'form'}->{$field} .= @{$users}[0]->{'email'} . " "; # delimit with spaces if necessary
push @{$vars->{'mform'}->{$field}}, @{$users}[0]->{'email'} . " "; if ($vars->{'form'}->{$field}) {
$vars->{'form'}->{$field} .= " ";
}
$vars->{'form'}->{$field} .= @{$users}[0]->{'email'};
push @{$vars->{'mform'}->{$field}}, @{$users}[0]->{'email'};
next; next;
} }
@ -324,10 +328,13 @@ sub match_field {
# here is where it checks for multiple matches # here is where it checks for multiple matches
if (scalar(@{$users}) == 1) { if (scalar(@{$users}) == 1) { # exactly one match
# exactly one match # delimit with spaces if necessary
$vars->{'form'}->{$field} .= @{$users}[0]->{'email'} . " "; if ($vars->{'form'}->{$field}) {
push @{$vars->{'mform'}->{$field}}, @{$users}[0]->{'email'} . " "; $vars->{'form'}->{$field} .= " ";
}
$vars->{'form'}->{$field} .= @{$users}[0]->{'email'};
push @{$vars->{'mform'}->{$field}}, @{$users}[0]->{'email'};
$need_confirm = 1 if &::Param('confirmuniqueusermatch'); $need_confirm = 1 if &::Param('confirmuniqueusermatch');
} }