Commit 8bc92049 authored by Koosha Khajeh Moogahi's avatar Koosha Khajeh Moogahi Committed by Frédéric Buclin

Bug 450546: Use visible_bugs() where appropriate instead of/in combination with…

Bug 450546: Use visible_bugs() where appropriate instead of/in combination with can_see_bug() to improve performance r/a=LpSolit
parent c658f1b0
......@@ -435,6 +435,7 @@ sub _page_user {
ORDER BY votes.bug_id',
undef, ($who->id, $product->id));
$user->visible_bugs([map { $_->[0] } @$vote_list]);
foreach (@$vote_list) {
my ($id, $count, $summary) = @$_;
$total += $count;
......
......@@ -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' });
}
}
}
......
......@@ -169,7 +169,10 @@ my $sth = $dbh->prepare(
q{SELECT bug_status, resolution, short_desc
FROM bugs
WHERE bugs.bug_id = ?});
foreach my $k (keys(%seen)) {
my @bug_ids = keys %seen;
$user->visible_bugs(\@bug_ids);
foreach my $k (@bug_ids) {
# Retrieve bug information from the database
my ($stat, $resolution, $summary) = $dbh->selectrow_array($sth, undef, $k);
......
......@@ -95,7 +95,7 @@ sub GenerateTree {
# Record this depth in the global $realdepth variable if it's farther
# than we've gone before.
$realdepth = max($realdepth, $depth);
Bugzilla->user->visible_bugs(\@dependencies);
foreach my $dep_id (@dependencies) {
# Get this dependency's record from the database and generate
# its sub-tree if we haven't already done so (which happens
......
......@@ -275,7 +275,7 @@ if ($do_report) {
function=>"summarize_time"});
}
@bugs = get_blocker_ids($bugs[0]);
@bugs = grep { $user->can_see_bug($_) } @bugs;
@bugs = @{ $user->visible_bugs(\@bugs) };
}
$start_date = trim $cgi->param('start_date');
......
......@@ -191,9 +191,8 @@
[% IF bugs.size > 0 %]
<td valign="middle" class="bz_query_buttons">
<form method="post" action="show_bug.cgi">
[% FOREACH id = buglist %]
[% id = buglist.join(",") %]
<input type="hidden" name="id" value="[% id FILTER html %]">
[% END %]
<input type="hidden" name="format" value="multiple">
<input type="submit" id="long_format" value="Long Format">
</form>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment