Open Bug 1003304 Opened 10 years ago Updated 2 months ago

Return 'creator_detail' for /rest/bug/<bug_id>/attachment to avoid additional lookup for real_name

Categories

(Bugzilla :: WebService, enhancement)

4.5.4
enhancement
Not set
normal

Tracking

()

People

(Reporter: emorley, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

In bug 1003227 comment 3, I'm wanting to find out the email address and display name for attachments, so that qimportbz can fix up the hg patch header when the patch creator has forgotten to include the author info in the patch.

The attachment info endpoint (https://bugzilla.mozilla.org/rest/bug/1002780/attachment) only returns 'attacher' (the user_id email address), and not their real_name as well. 

I could make another call to /rest/user/<attacher_id> to find it out, but given that the main /rest/bug/<bug_id> endpoint returns real_name for a bunch of fields (eg under 'assigned_to_detail', 'cc_detail', 'creator_detail' and 'qa_contact_detail'), it seems we have a precedent for avoiding the additional lookup perhaps? I guess people can use include/exclude fields if they don't require it, to avoid additional joins in the DB query?
Seems like if we were ok with adding this, we should move Bug::_user_to_hash() (added by bug 916254) to Util.pm or User.pm and use it for Bug.get as well as Attachment.get - yeah?
We should do this as part of the upstream.

dkl
Assignee: nobody → webservice
Severity: normal → enhancement
Component: API → WebService
Product: bugzilla.mozilla.org → Bugzilla
QA Contact: default-qa
Target Milestone: --- → Bugzilla 5.0
Version: Production → 4.5.4
(In reply to Ed Morley [:edmorley UTC+0] from comment #0)
> I guess people can use include/exclude fields if they don't require it, to avoid additional joins
> in the DB query?

now that bug 540818 has landed, that's exactly what we should do :)
Target Milestone: Bugzilla 5.0 → ---
Assignee: webservice → mail
Status: NEW → ASSIGNED
Attachment #8798793 - Flags: review?(dylan)
Attachment #8798793 - Flags: review?(dylan) → review?(dylan)
Attachment #8798793 - Flags: review?(dylan) → review?(gerv)
Assignee: mail → webservice
Status: ASSIGNED → NEW
Comment on attachment 8798793 [details] [diff] [review]
bug1003304-v1.patch

I'm sorry, but I will be unable to do this review. My apologies :-(

Gerv
Attachment #8798793 - Flags: review?(gerv)
Attachment #8798793 - Flags: review?(dkl)
Comment on attachment 8798793 [details] [diff] [review]
bug1003304-v1.patch

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

Looks good code-wise. Assume you have tested it with latest master. r=dkl
Attachment #8798793 - Flags: review?(dkl) → review+

This bug has an r+'d patch - could someone land it?

Attachment #9381636 - Attachment is obsolete: true
The content of attachment 9381636 [details] has been deleted for the following reason:

Spam
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: