From 6be9f0a286b2e9abf0119173a9e66c37a7d9f0a1 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Mon, 4 Apr 2016 16:27:33 +0000 Subject: Bug 880163 - add a webservice method to list a bug's duplicates, mirroring what is visible on show_bug. r=dylan --- Bugzilla/API/1_0/Resource/Bug.pm | 3 +++ Bugzilla/WebService/Bug.pm | 7 +++++++ docs/en/rst/api/core/v1/bug.rst | 15 ++++++++------- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Bugzilla/API/1_0/Resource/Bug.pm b/Bugzilla/API/1_0/Resource/Bug.pm index 5dc61e8d1..781ac3176 100644 --- a/Bugzilla/API/1_0/Resource/Bug.pm +++ b/Bugzilla/API/1_0/Resource/Bug.pm @@ -1491,6 +1491,9 @@ sub _bug_to_hash { if (filter_wants $params, 'tags', 'extra') { $item{'tags'} = $bug->tags; } + if (filter_wants $params, 'duplicates', 'extra') { + $item{'duplicates'} = [ map { as_int($_->id) } @{ $bug->duplicates } ]; + } # And now custom fields my @custom_fields = Bugzilla->active_custom_fields; diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index a1c6b7d99..2279395a1 100644 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -1377,6 +1377,9 @@ sub _bug_to_hash { if (filter_wants $params, 'tags', 'extra') { $item{'tags'} = $bug->tags; } + if (filter_wants $params, 'duplicates', 'extra') { + $item{'duplicates'} = [ map { $self->type('int', $_->id) } @{ $bug->duplicates } ]; + } # And now custom fields my @custom_fields = Bugzilla->active_custom_fields; @@ -2590,6 +2593,10 @@ C of Cs. Each array item is a tag name. Note that tags are personal to the currently logged in user. +=item C + +C of C. Each array item is a bug ID that is a duplicate of this bug. + =back =item C B diff --git a/docs/en/rst/api/core/v1/bug.rst b/docs/en/rst/api/core/v1/bug.rst index f4ca0dac4..e13b17129 100644 --- a/docs/en/rst/api/core/v1/bug.rst +++ b/docs/en/rst/api/core/v1/bug.rst @@ -234,13 +234,14 @@ Extra fields: These fields are returned only by specifying ``_extra`` or the field name in ``include_fields``. -==== ===== ==================================================================== -name type description -==== ===== ==================================================================== -tags array Each array item is a tag name. Note that tags are - personal to the currently logged in user and are not the same as - comment tags. -==== ===== ==================================================================== +========== ===== ==================================================================== +name type description +========== ===== ==================================================================== +tags array Each array item is a tag name. Note that tags are + personal to the currently logged in user and are not the same as + comment tags. +duplicates array Each array item is a bug ID that is a duplicate of this bug. +========== ===== ==================================================================== User object: -- cgit v1.2.3-24-g4f1b