]> 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:21:04 +0000 (20:21 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 20 Sep 2012 18:21:04 +0000 (20:21 +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 e5ae4bfd05b9eccdc89dbc0913fb94acaf31c5b9..cc568fbce3ee4c6ed321324c7f9145db0d8c5094 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 ff0602d46c3035d1442beaaa24ad289d938cf3d6..67faced198f3e992cc9486c00fb992c5bbb41a4e 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 4031ed26375ab65598cdc81206860b6781cb3840..f4d5e3785ae44aeb5f47c9409de918793ed75077 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 e06d3257d346778aa5f6d262b71b089aa53f2649..d77634da5e822e1022317d54d487c27976304664 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>