diff options
author | mkanat%bugzilla.org <> | 2008-06-30 04:57:54 +0200 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2008-06-30 04:57:54 +0200 |
commit | c1ca86053ed276aa05eac8468cea61785629ac5e (patch) | |
tree | 836d5cae869dc47008b16bccb1de47320a36fcc8 /Bugzilla | |
parent | 9ed763d945ffe2a468871d4731f3bd001caab21c (diff) | |
download | bugzilla-c1ca86053ed276aa05eac8468cea61785629ac5e.tar.gz bugzilla-c1ca86053ed276aa05eac8468cea61785629ac5e.tar.xz |
Bug 440612 â Use Bugzilla::Bug->check everywhere instead of ValidateBugID
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Bug.pm | 16 | ||||
-rwxr-xr-x | Bugzilla/WebService/Bug.pm | 4 |
2 files changed, 8 insertions, 12 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index c32672ce2..e2620203e 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -49,7 +49,7 @@ use Storable qw(dclone); use base qw(Bugzilla::Object Exporter); @Bugzilla::Bug::EXPORT = qw( - bug_alias_to_id ValidateBugID + bug_alias_to_id RemoveVotes CheckIfVotedConfirmed LogActivityEntry editable_bug_fields @@ -1091,8 +1091,8 @@ sub _check_dependencies { my @bug_ids = split(/[\s,]+/, $deps_in{$type}); # Eliminate nulls. @bug_ids = grep {$_} @bug_ids; - # We do Validate up here to make sure all aliases are converted to IDs. - ValidateBugID($_, $type) foreach @bug_ids; + # We do this up here to make sure all aliases are converted to IDs. + @bug_ids = map { $invocant->check($_, $type)->id } @bug_ids; my @check_access = @bug_ids; # When we're updating a bug, only added or removed bug_ids are @@ -1114,11 +1114,10 @@ sub _check_dependencies { my $user = Bugzilla->user; foreach my $modified_id (@check_access) { - ValidateBugID($modified_id); + my $delta_bug = $invocant->check($modified_id); # Under strict isolation, you can't modify a bug if you can't # edit it, even if you can see it. if (Bugzilla->params->{"strict_isolation"}) { - my $delta_bug = new Bugzilla::Bug($modified_id); if (!$user->can_edit_product($delta_bug->{'product_id'})) { ThrowUserError("illegal_change_deps", {field => $type}); } @@ -1142,7 +1141,7 @@ sub _check_dup_id { $dupe_of = trim($dupe_of); $dupe_of || ThrowCodeError('undefined_field', { field => 'dup_id' }); # Make sure we can change the original bug (issue A on bug 96085) - ValidateBugID($dupe_of, 'dup_id'); + my $dupe_of_bug = $self->check($dupe_of, 'dup_id'); # Make sure a loop isn't created when marking this bug # as duplicate. @@ -1174,7 +1173,6 @@ sub _check_dup_id { # Should we add the reporter to the CC list of the new bug? # If he can see the bug... if ($self->reporter->can_see_bug($dupe_of)) { - my $dupe_of_bug = new Bugzilla::Bug($dupe_of); # We only add him if he's not the reporter of the other bug. $self->{_add_dup_cc} = 1 if $dupe_of_bug->reporter->id != $self->reporter->id; @@ -1199,9 +1197,7 @@ sub _check_dup_id { my $vars = {}; my $template = Bugzilla->template; # Ask the user what they want to do about the reporter. - $vars->{'cclist_accessible'} = $dbh->selectrow_array( - q{SELECT cclist_accessible FROM bugs WHERE bug_id = ?}, - undef, $dupe_of); + $vars->{'cclist_accessible'} = $dupe_of_bug->cclist_accessible; $vars->{'original_bug_id'} = $dupe_of; $vars->{'duplicate_bug_id'} = $self->id; print $cgi->header(); diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index dd866a67b..3323fd5dd 100755 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -123,7 +123,8 @@ sub get_history { my @return; foreach my $bug_id (@$ids) { my %item; - ValidateBugID($bug_id); + my $bug = Bugzilla::Bug->check($bug_id); + $bug_id = $bug->id; my ($activity) = Bugzilla::Bug::GetBugActivity($bug_id); $item{$bug_id} = []; @@ -155,7 +156,6 @@ sub get_history { # alias is returned in case users passes a mixture of ids and aliases # then they get to know which bug activity relates to which value # they passed - my $bug = new Bugzilla::Bug($bug_id); if (Bugzilla->params->{'usebugaliases'}) { $item{alias} = type('string')->value($bug->alias); } |