diff options
author | 2012-09-20 20:23:32 +0200 | |
---|---|---|
committer | 2012-09-20 20:23:32 +0200 | |
commit | 13c80032701ba7c1c18cc92b8882d8345a13660d (patch) | |
tree | f164ceba5d6abdc24804c4260a34390204876535 /show_bug.cgi | |
parent | Bug 308709: Misleading confirmation when entering an invalid sort key for a f... (diff) | |
download | bugzilla-13c80032701ba7c1c18cc92b8882d8345a13660d.tar.gz bugzilla-13c80032701ba7c1c18cc92b8882d8345a13660d.tar.bz2 bugzilla-13c80032701ba7c1c18cc92b8882d8345a13660d.zip |
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-x | show_bug.cgi | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/show_bug.cgi b/show_bug.cgi index 48d75512b..a94617c1c 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' }); } } } |