]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 916254 - Bug.get should include the name for reporter, assigned_to and qa_contact
authorFrank Becker <Frank@Frank-Becker.de>
Fri, 11 Oct 2013 15:39:12 +0000 (11:39 -0400)
committerDave Lawrence <dlawrence@mozilla.com>
Fri, 11 Oct 2013 15:39:12 +0000 (11:39 -0400)
r=dkl,a=sgreen

Bugzilla/WebService/Bug.pm

index e2b06a378ad29a7899f6b7e3b49cb6ff296d724b..0760503a6ccee838801a4e2d899fbdcf8f743b6e 100644 (file)
@@ -1045,6 +1045,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 };
@@ -1062,6 +1063,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 };
@@ -1089,6 +1091,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) }
@@ -1141,6 +1146,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) = @_;
 
@@ -2006,6 +2022,11 @@ C<string> The unique alias of this bug.
 
 C<string> The login name of the user to whom the bug is assigned.
 
+=item C<assigned_to_detail> 
+
+C<hash> A hash containing detailed user information for the assigned_to. To see the 
+keys included in the user detail hash, see below.
+
 =item C<blocks>
 
 C<array> of C<int>s. The ids of bugs that are "blocked" by this bug.
@@ -2031,6 +2052,11 @@ C<dateTime> When the bug was created.
 
 C<string> The login name of the person who filed this bug (the reporter).
 
+=item C<creator_detail> 
+
+C<hash> A hash containing detailed user information for the creator. To see the 
+keys included in the user detail hash, see below.
+
 =item C<deadline>
 
 C<string> The day that this bug is due to be completed, in the format
@@ -2152,6 +2178,11 @@ C<string> The name of the product this bug is in.
 
 C<string> The login name of the current QA Contact on the bug.
 
+=item C<qa_contact_detail>
+
+C<hash> A hash containing detailed user information for the qa_contact. To see the
+keys included in the user detail hash, see below.
+
 =item C<remaining_time>
 
 C<double> The number of hours of work remaining until work on this bug
@@ -2227,6 +2258,30 @@ field types have different return values:
 
 =back 
 
+=item I<user detail hashes> 
+
+Each user detail hash contains the following items:
+
+=over
+
+=item C<id>
+
+C<int> The user id for this user.
+
+=item C<real_name>
+
+C<string> The 'real' name for this user, if any.
+
+=item C<name>
+
+C<string> The user's Bugzilla login.
+
+=item C<email>
+
+C<string> The user's email address. Currently this is the same value as the name.
+
+=back
+
 =back
 
 =item C<faults> B<EXPERIMENTAL>
@@ -2328,6 +2383,8 @@ in Bugzilla B<4.4>.
 
 =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<assigned_to_detail>, C<creator_detail>, C<qa_contact_detail>. 
+
 =back
 
 =back