]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 450546: Use visible_bugs() where appropriate instead of/in combination with can_s...
authorKoosha Khajeh Moogahi <koosha.khajeh@gmail.com>
Thu, 20 Sep 2012 18:23:32 +0000 (20:23 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 20 Sep 2012 18:23:32 +0000 (20:23 +0200)
r/a=LpSolit

extensions/Voting/Extension.pm
show_bug.cgi
showdependencygraph.cgi
showdependencytree.cgi
summarize_time.cgi
template/en/default/list/list.html.tmpl

index b4352fa2f2854459070bcfba30ee5874b43c3282..4cb8171e8c0470945cb78965129e8060b067f29f 100644 (file)
@@ -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;
index 48d75512b949a1164c267434ea9728b1c3831b07..a94617c1cf818356df03056891b70c826da38d98 100755 (executable)
@@ -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' });
             }
         }
     }
index 842e12f2a9bd74395aa3adc504000e29864e799b..4587f5dc29178b1473dab73e8a5cb610ba10144f 100755 (executable)
@@ -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);
 
index f8844b702ae80a47aa1718520fb3781f527d1f97..6b07a9ec86da03ad8d4bbe85329953ef9adb6784 100755 (executable)
@@ -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
index fa13a5162e97094552b99c14f197208672c7222b..5e0df959d09ae4765f7bbf875e8547980f99b651 100755 (executable)
@@ -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');
index 1c5c228105eb8b42ba95be2cbb92edc56835e493..3be607a38c245285a87078cc80b21a9e8c22a8c2 100644 (file)
     [% 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>