]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 472556: Modify Bug.comments to allow getting comments only comments that have...
authormkanat%bugzilla.org <>
Fri, 9 Jan 2009 07:49:36 +0000 (07:49 +0000)
committermkanat%bugzilla.org <>
Fri, 9 Jan 2009 07:49:36 +0000 (07:49 +0000)
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=mkanat

Bugzilla/Bug.pm
Bugzilla/WebService/Bug.pm

index cfc01ba7b6022f138c52a7a823a42a1173a707ff..d941a766e1c26c9d1360bf569253c1e73b14ab77 100644 (file)
@@ -2853,11 +2853,16 @@ sub GetComments {
              INNER JOIN profiles
                      ON profiles.userid = longdescs.who
                   WHERE longdescs.bug_id = ?';
+
     if ($start) {
-        $query .= ' AND longdescs.bug_when > ?
-                    AND longdescs.bug_when <= ?';
-        push(@args, ($start, $end));
+        $query .= ' AND longdescs.bug_when > ?';
+        push(@args, $start);
+    }
+    if ($end) {
+        $query .= ' AND longdescs.bug_when <= ?';
+        push(@args, $end);
     }
+
     $query .= " ORDER BY longdescs.bug_when $sort_order";
     my $sth = $dbh->prepare($query);
     $sth->execute(@args);
index 10ea1f8863399f05b9a52958dcd0a3c171c449be..9d58538f2ec642e5b61f89fcd5052d7b13434fc5 100755 (executable)
@@ -78,7 +78,7 @@ sub comments {
         my $bug = Bugzilla::Bug->check($bug_id);
         # We want the API to always return comments in the same order.
         my $comments = Bugzilla::Bug::GetComments(
-            $bug->id, 'oldest_to_newest');
+            $bug->id, 'oldest_to_newest', $params->{new_since});
         my @result;
         foreach my $comment (@$comments) {
             next if $comment->{isprivate} && !$user->is_insider;
@@ -439,6 +439,13 @@ C<array> An array of integer comment_ids. These comments will be
 returned individually, separate from any other comments in their
 respective bugs.
 
+=item C<new_since>
+
+C<dateTime> If specified, the method will only return comments I<newer>
+than this time. This only affects comments returned from the C<bug_ids>
+argument. You will always be returned all comments you request in the
+C<comment_ids> argument, even if they are older than this date.
+
 =back
 
 =item B<Returns>