From 4e1a9ffcb681951b2138e0781062d1d559bc8af2 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Fri, 9 Jan 2009 07:49:36 +0000 Subject: Bug 472556: Modify Bug.comments to allow getting comments only comments that have been added since a certain time Patch By Max Kanat-Alexander r=dkl, a=mkanat --- Bugzilla/Bug.pm | 11 ++++++++--- Bugzilla/WebService/Bug.pm | 9 ++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index cfc01ba7b..d941a766e 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -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); diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index 10ea1f886..9d58538f2 100755 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -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 An array of integer comment_ids. These comments will be returned individually, separate from any other comments in their respective bugs. +=item C + +C If specified, the method will only return comments I +than this time. This only affects comments returned from the C +argument. You will always be returned all comments you request in the +C argument, even if they are older than this date. + =back =item B -- cgit v1.2.3-24-g4f1b