diff options
author | Koosha Khajeh Moogahi <koosha.khajeh@gmail.com> | 2012-09-20 20:21:04 +0200 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2012-09-20 20:21:04 +0200 |
commit | 8bc92049518f57d645b1e3290667c21d502d0d56 (patch) | |
tree | 269bc7d2b60377a035d139062cbbb7e8935801e3 | |
parent | Bug 308709: Misleading confirmation when entering an invalid sort key for a f... (diff) | |
download | bugzilla-8bc92049518f57d645b1e3290667c21d502d0d56.tar.gz bugzilla-8bc92049518f57d645b1e3290667c21d502d0d56.tar.bz2 bugzilla-8bc92049518f57d645b1e3290667c21d502d0d56.zip |
Bug 450546: Use visible_bugs() where appropriate instead of/in combination with can_see_bug() to improve performance
r/a=LpSolit
-rw-r--r-- | extensions/Voting/Extension.pm | 1 | ||||
-rwxr-xr-x | show_bug.cgi | 18 | ||||
-rwxr-xr-x | showdependencygraph.cgi | 5 | ||||
-rwxr-xr-x | showdependencytree.cgi | 2 | ||||
-rwxr-xr-x | summarize_time.cgi | 2 | ||||
-rw-r--r-- | template/en/default/list/list.html.tmpl | 5 |
6 files changed, 24 insertions, 9 deletions
diff --git a/extensions/Voting/Extension.pm b/extensions/Voting/Extension.pm index b4352fa2f..4cb8171e8 100644 --- a/extensions/Voting/Extension.pm +++ b/extensions/Voting/Extension.pm @@ -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; 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' }); } } } diff --git a/showdependencygraph.cgi b/showdependencygraph.cgi index ff0602d46..67faced19 100755 --- a/showdependencygraph.cgi +++ b/showdependencygraph.cgi @@ -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); diff --git a/showdependencytree.cgi b/showdependencytree.cgi index 4031ed263..f4d5e3785 100755 --- a/showdependencytree.cgi +++ b/showdependencytree.cgi @@ -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 diff --git a/summarize_time.cgi b/summarize_time.cgi index e06d3257d..d77634da5 100755 --- a/summarize_time.cgi +++ b/summarize_time.cgi @@ -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'); diff --git a/template/en/default/list/list.html.tmpl b/template/en/default/list/list.html.tmpl index 1c5c22810..3be607a38 100644 --- a/template/en/default/list/list.html.tmpl +++ b/template/en/default/list/list.html.tmpl @@ -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 %] - <input type="hidden" name="id" value="[% id FILTER html %]"> - [% END %] + [% id = buglist.join(",") %] + <input type="hidden" name="id" value="[% id FILTER html %]"> <input type="hidden" name="format" value="multiple"> <input type="submit" id="long_format" value="Long Format"> </form> |