summaryrefslogtreecommitdiffstats
path: root/show_bug.cgi
diff options
context:
space:
mode:
authorKoosha Khajeh Moogahi <koosha.khajeh@gmail.com>2012-09-20 20:21:04 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-09-20 20:21:04 +0200
commit8bc92049518f57d645b1e3290667c21d502d0d56 (patch)
tree269bc7d2b60377a035d139062cbbb7e8935801e3 /show_bug.cgi
parentc658f1b025d74ae9b4c7716d81377b68a1cc5a52 (diff)
downloadbugzilla-8bc92049518f57d645b1e3290667c21d502d0d56.tar.gz
bugzilla-8bc92049518f57d645b1e3290667c21d502d0d56.tar.xz
Bug 450546: Use visible_bugs() where appropriate instead of/in combination with can_see_bug() to improve performance
r/a=LpSolit
Diffstat (limited to 'show_bug.cgi')
-rwxr-xr-xshow_bug.cgi18
1 files changed, 15 insertions, 3 deletions
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' });
}
}
}