From 6c94610a36860c288f0bf692ca111e4cf9052bb5 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Fri, 18 Oct 2013 11:26:13 -0400 Subject: Bug 925780 - backport upstream bug 916254 to bmo/4.2 to extend Bug.get to return user details --- Bugzilla/WebService/Bug.pm | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'Bugzilla/WebService') diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index b47cf7366..b952f346b 100644 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -1069,6 +1069,7 @@ sub _bug_to_hash { # eliminate them anyway. if (filter_wants $params, 'assigned_to') { $item{'assigned_to'} = $self->type('email', $bug->assigned_to->login); + $item{'assigned_to_detail'} = $self->_user_to_hash($bug->assigned_to, $params, 'assigned_to'); } if (filter_wants $params, 'blocks') { my @blocks = map { $self->type('int', $_) } @{ $bug->blocked }; @@ -1080,6 +1081,7 @@ sub _bug_to_hash { } if (filter_wants $params, 'creator') { $item{'creator'} = $self->type('email', $bug->reporter->login); + $item{'creator_detail'} = $self->_user_to_hash($bug->reporter, $params, 'creator'); } if (filter_wants $params, 'depends_on') { my @depends_on = map { $self->type('int', $_) } @{ $bug->dependson }; @@ -1104,6 +1106,9 @@ sub _bug_to_hash { if (filter_wants $params, 'qa_contact') { my $qa_login = $bug->qa_contact ? $bug->qa_contact->login : ''; $item{'qa_contact'} = $self->type('email', $qa_login); + if ($bug->qa_contact) { + $item{'qa_contact_detail'} = $self->_user_to_hash($bug->qa_contact, $params, 'qa_contact'); + } } if (filter_wants $params, 'see_also') { my @see_also = map { $self->type('string', $_->name) } @@ -1157,6 +1162,17 @@ sub _bug_to_hash { return filter $params, \%item; } +sub _user_to_hash { + my ($self, $user, $filters, $prefix) = @_; + my $item = filter $filters, { + id => $self->type('int', $user->id), + real_name => $self->type('string', $user->name), + name => $self->type('email', $user->login), + email => $self->type('email', $user->email), + }, $prefix; + return $item; +} + sub _attachment_to_hash { my ($self, $attach, $filters) = @_; @@ -2009,6 +2025,11 @@ C The unique alias of this bug. C The login name of the user to whom the bug is assigned. +=item C + +C A hash containing detailed user information for the assigned_to. To see the +keys included in the user detail hash, see below. + =item C C of Cs. The ids of bugs that are "blocked" by this bug. @@ -2034,6 +2055,11 @@ C When the bug was created. C The login name of the person who filed this bug (the reporter). +=item C + +C A hash containing detailed user information for the creator. To see the +keys included in the user detail hash, see below. + =item C C The day that this bug is due to be completed, in the format @@ -2158,6 +2184,11 @@ C The name of the product this bug is in. C The login name of the current QA Contact on the bug. +=item C + +C A hash containing detailed user information for the qa_contact. To see the +keys included in the user detail hash, see below. + =item C C The number of hours of work remaining until work on this bug @@ -2233,6 +2264,30 @@ field types have different return values: =back +=item I + +Each user detail hash contains the following items: + +=over + +=item C + +C The user id for this user. + +=item C + +C The 'real' name for this user, if any. + +=item C + +C The user's Bugzilla login. + +=item C + +C The user's email address. Currently this is the same value as the name. + +=back + =back =item C B @@ -3310,6 +3365,8 @@ code of 32000. =item REST API call added in Bugzilla B<5.0>. +=item In Bugzilla B<5.0>, the following items were added to the bugs return value: C, C, C. + =back =back -- cgit v1.2.3-24-g4f1b