Bug 440609 ��� Implement Bugzilla::Bug->check for use instead of ValidateBugID and use it in one file

Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
This commit is contained in:
mkanat%bugzilla.org 2008-06-26 01:00:12 +00:00
Родитель 148ee937f7
Коммит 9b67c8ecf4
2 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -272,6 +272,15 @@ sub new {
return $self;
}
sub check {
my $class = shift;
# XXX At some point we will eliminate ValidateBugID and make this
# method more efficient.
ValidateBugID(@_);
my $self = $class->new(@_);
return $self;
}
# Docs for create() (there's no POD in this file yet, but we very
# much need this documented right now):
#

Просмотреть файл

@ -75,8 +75,7 @@ sub get {
my @return;
foreach my $bug_id (@$ids) {
ValidateBugID($bug_id);
my $bug = new Bugzilla::Bug($bug_id);
my $bug = Bugzilla::Bug->check($bug_id);
# Timetracking fields are deleted if the user doesn't belong to
# the corresponding group.
@ -247,14 +246,12 @@ sub add_comment {
# Check parameters
defined $params->{id}
|| ThrowCodeError('param_required', { param => 'id' });
ValidateBugID($params->{id});
|| ThrowCodeError('param_required', { param => 'id' });
my $comment = $params->{comment};
defined $comment
|| ThrowCodeError('param_required', { param => 'comment' });
my $bug = new Bugzilla::Bug($params->{id});
my $bug = Bugzilla::Bug->check($params->{id});
Bugzilla->user->can_edit_product($bug->product_id)
|| ThrowUserError("product_edit_denied", {product => $bug->product});