Closed Bug 880163 Opened 11 years ago Closed 8 years ago

add a webservice method to list a bug's duplicates, mirroring what is visible on show_bug.

Categories

(Bugzilla :: WebService, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 6.0

People

(Reporter: glob, Assigned: dkl)

References

Details

Attachments

(1 file, 3 obsolete files)

add a webservice method to list a bug's duplicates, mirroring what is visible on show_bug.
Severity: normal → enhancement
OS: Mac OS X → All
Hardware: x86 → All
There is already a webservice that provides this functionality in 4.0 and greater. Just not documented in the API docs.

http://bzr.mozilla.org/bugzilla/trunk/annotate/head:/Bugzilla/WebService/Bug.pm#L478

We can work on documenting this as part of this bug.

dkl
Summary: add a webservice method to list a bug's duplicates → Document Bug.possible_duplicates webservice method that list a bug's possible duplicates
Assignee: webservice → dkl
Status: NEW → ASSIGNED
Attachment #759424 - Flags: review?(glob)
this request isn't for possible duplicates on enter_bug, it's about getting a list of actual duplicates which are visible on show_bug.
Summary: Document Bug.possible_duplicates webservice method that list a bug's possible duplicates → add a webservice method to list a bug's duplicates, mirroring what is visible on show_bug.
Attachment #759424 - Flags: review?(glob)
(In reply to Byron Jones ‹:glob› from comment #3)
> this request isn't for possible duplicates on enter_bug, it's about getting
> a list of actual duplicates which are visible on show_bug.

Ugh. Misread your first comment and should have assumed your knew there was already a webservice method. It was confusing that you were asking for a webservice method to be added for this. Why can't the current method therefore be used from show_bug.cgi as well if a user wants to see other similar bugs to what the current summary is. I could envision a link/button next to the summary and then a table appears similar to enter_bug.cgi.

dkl
(In reply to David Lawrence [:dkl] from comment #4)
> Why can't the current method
> therefore be used from show_bug.cgi as well if a user wants to see other
> similar bugs to what the current summary is. I could envision a link/button
> next to the summary and then a table appears similar to enter_bug.cgi.

i'm not requesting any UI changes, nor is this request in any way related to possible duplicates.

i'd like a new webservice method which returns the current duplicates of a bug.
ie. return $bug->duplicates()

i don't think this should be added to the fields which we currently return by Bug.get as new fields are always included by default, so adding a "duplicates" field will result in unnecessary overhead.
Want to use this in BzDeck. The app currently scrapes bug comments to generate duplicated bug lists, but it's obviously not ideal.

https://github.com/bzdeck/bzdeck/blob/master/webroot/static/scripts/models/bug.js#L224-L243
Attached patch 880163_1.patch (obsolete) — Splinter Review
Attachment #759424 - Attachment is obsolete: true
Attachment #8694982 - Flags: review?(gerv)
Comment on attachment 8694982 [details] [diff] [review]
880163_1.patch

Review of attachment 8694982 [details] [diff] [review]:
-----------------------------------------------------------------

::: Bugzilla/API/1_0/Resource/Bug.pm
@@ +2814,5 @@
> +=over
> +
> +=item B<Description>
> +
> +Gets list of bug ids that are closed as duplicates of the bug ids provided.

IDs or ID? Does this allow you to submit multiple IDs or not? A few bits of the docs hint that you can pass multiple IDs, but I can't see how on the URL, and I can't see how the returned data would be useful as you couldn't tell which ID was a duplicate of which submitted ID.

::: Bugzilla/WebService/Bug.pm
@@ +345,5 @@
> +        my $bug = Bugzilla::Bug->check($bug_id);
> +        $bugs{$bug_id} = [ map { $self->type('int', $_->id) } @{ $bug->duplicates } ];
> +    }
> +
> +    return { bugs => \%bugs };

Remind me why we have this entire function duplicated in two places in the codebase?
Attachment #8694982 - Flags: review?(gerv) → review-
Do we need a new method for this? I'd rather like to see the "duplicates" field as part of /rest/bug along with "blocks" and "depends_on". It won't break the backward compatibility.

https://bugzilla.readthedocs.org/en/latest/api/core/v1/bug.html#get-bug
(In reply to Kohei Yoshino [:kohei] from comment #9)
> Do we need a new method for this? I'd rather like to see the "duplicates"
> field as part of /rest/bug along with "blocks" and "depends_on". It won't
> break the backward compatibility.

unfortunately this needs to be a new method.

bugzilla's api works by including all fields by default, with callers opting out where required.  this makes adding new fields which are expensive to generate problematic.
Attached patch 880163_1.patch (obsolete) — Splinter Review
Actually with modern code in 5.0 and up, we can add new fields as needed without adding to the default set returned. So I added to 'duplicates' to the data returned and is only visible if the user explicitly asks for 'extra' fields or field by name.

dkl
Attachment #8694982 - Attachment is obsolete: true
Attachment #8732154 - Flags: review?(dylan)
Comment on attachment 8732154 [details] [diff] [review]
880163_1.patch

Review of attachment 8732154 [details] [diff] [review]:
-----------------------------------------------------------------

XMLRPC/JSON RPC doesn't work :-)

r-

::: Bugzilla/WebService/Bug.pm
@@ +1373,5 @@
>      if (filter_wants $params, 'tags', 'extra') {
>          $item{'tags'} = $bug->tags;
>      }
> +    if (filter_wants $params, 'duplicates', 'extra') {
> +        $item{'duplicates'} = [ map { as_int($_->id) } @{ $bug->duplicates } ];

as_int() is not defined here.

Undefined subroutine &Bugzilla::WebService::Bug::as_int called at Bugzilla/WebService/Bug.pm line 1381.
Attachment #8732154 - Flags: review?(dylan) → review-
Attached patch 880163_2.patchSplinter Review
Attachment #8732154 - Attachment is obsolete: true
Attachment #8733503 - Flags: review?(dylan)
Comment on attachment 8733503 [details] [diff] [review]
880163_2.patch

Review of attachment 8733503 [details] [diff] [review]:
-----------------------------------------------------------------

r=dylan
Attachment #8733503 - Flags: review?(dylan) → review+
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   206927e..6be9f0a  master -> master
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Can we get this backported to BMO?
Flags: needinfo?(dkl)
Target Milestone: --- → Bugzilla 6.0
(In reply to Kohei Yoshino [:kohei] from comment #16)
> Can we get this backported to BMO?

We will be porting BMO over to upstream master in the near future so will wait for that instead. We would have to also backport a lot of other code to support 'extra' fields so that is is not a quick port.

dkl
Flags: needinfo?(dkl)
Sounds good.
See Also: → 1263502
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: