From 8bc92049518f57d645b1e3290667c21d502d0d56 Mon Sep 17 00:00:00 2001 From: Koosha Khajeh Moogahi Date: Thu, 20 Sep 2012 20:21:04 +0200 Subject: Bug 450546: Use visible_bugs() where appropriate instead of/in combination with can_see_bug() to improve performance r/a=LpSolit --- show_bug.cgi | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'show_bug.cgi') diff --git a/show_bug.cgi b/show_bug.cgi index e5ae4bfd0..cc568fbce 100755 --- a/show_bug.cgi +++ b/show_bug.cgi @@ -63,15 +63,27 @@ if ($single) { foreach my $id ($cgi->param('id')) { # Be kind enough and accept URLs of the form: id=1,2,3. my @ids = split(/,/, $id); + my @check_bugs; + foreach my $bug_id (@ids) { next unless $bug_id; my $bug = new Bugzilla::Bug($bug_id); - if (!$bug->{error} && $user->can_see_bug($bug->bug_id)) { + if (!$bug->{error}) { + push(@check_bugs, $bug); + } + else { + push(@illegal_bugs, { bug_id => trim($bug_id), error => $bug->{error} }); + } + } + + $user->visible_bugs(\@check_bugs); + + foreach my $bug (@check_bugs) { + if ($user->can_see_bug($bug->id)) { push(@bugs, $bug); } else { - push(@illegal_bugs, { bug_id => trim($bug_id), - error => $bug->{error} || 'NotPermitted' }); + push(@illegal_bugs, { bug_id => $bug->id, error => 'NotPermitted' }); } } } -- cgit v1.2.3-24-g4f1b