From 3891b63a1eb52076337885487f251a10580a4a85 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Wed, 27 Apr 2016 18:50:13 +0200 Subject: Bug 218917 - Allow the login name to be different from the email address Original patch by Gervase Markham r=gerv a=dkl --- Bugzilla/WebService/Bug.pm | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'Bugzilla/WebService/Bug.pm') diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index 2279395a1..d137000a9 100644 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -366,7 +366,7 @@ sub _translate_comment { my $comment_hash = { id => $self->type('int', $comment->id), bug_id => $self->type('int', $comment->bug_id), - creator => $self->type('email', $comment->author->login), + creator => $self->type('login', $comment->author->login), time => $self->type('dateTime', $comment->creation_ts), creation_time => $self->type('dateTime', $comment->creation_ts), is_private => $self->type('boolean', $comment->is_private), @@ -1308,7 +1308,7 @@ sub _bug_to_hash { $item{alias} = [ map { $self->type('string', $_) } @{ $bug->alias } ]; } if (filter_wants $params, 'assigned_to') { - $item{'assigned_to'} = $self->type('email', $bug->assigned_to->login); + $item{'assigned_to'} = $self->type('login', $bug->assigned_to->login); $item{'assigned_to_detail'} = $self->_user_to_hash($bug->assigned_to, $params, undef, 'assigned_to'); } if (filter_wants $params, 'blocks') { @@ -1322,7 +1322,7 @@ sub _bug_to_hash { $item{component} = $self->type('string', $bug->component); } if (filter_wants $params, 'cc') { - my @cc = map { $self->type('email', $_) } @{ $bug->cc }; + my @cc = map { $self->type('login', $_) } @{ $bug->cc }; $item{'cc'} = \@cc; $item{'cc_detail'} = [ map { $self->_user_to_hash($_, $params, undef, 'cc') } @{ $bug->cc_users } ]; } @@ -1330,7 +1330,7 @@ sub _bug_to_hash { $item{'creation_time'} = $self->type('dateTime', $bug->creation_ts); } if (filter_wants $params, 'creator') { - $item{'creator'} = $self->type('email', $bug->reporter->login); + $item{'creator'} = $self->type('login', $bug->reporter->login); $item{'creator_detail'} = $self->_user_to_hash($bug->reporter, $params, undef, 'creator'); } if (filter_wants $params, 'depends_on') { @@ -1361,7 +1361,7 @@ 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); + $item{'qa_contact'} = $self->type('login', $qa_login); if ($bug->qa_contact) { $item{'qa_contact_detail'} = $self->_user_to_hash($bug->qa_contact, $params, undef, 'qa_contact'); } @@ -1433,8 +1433,7 @@ sub _user_to_hash { 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), + name => $self->type('login', $user->login), }, $types, $prefix; return $item; } @@ -1455,10 +1454,10 @@ sub _attachment_to_hash { is_patch => $self->type('int', $attach->ispatch), }, $types, $prefix; - # creator requires an extra lookup, so we only send them if - # the filter wants them. + # creator requires an extra lookup, so we only send it if + # the filter wants it. if (filter_wants $filters, 'creator', $types, $prefix) { - $item->{'creator'} = $self->type('email', $attach->attacher->login); + $item->{'creator'} = $self->type('login', $attach->attacher->login); } if (filter_wants $filters, 'data', $types, $prefix) { @@ -1490,7 +1489,7 @@ sub _flag_to_hash { foreach my $field (qw(setter requestee)) { my $field_id = $field . "_id"; - $item->{$field} = $self->type('email', $flag->$field->login) + $item->{$field} = $self->type('login', $flag->$field->login) if $flag->$field_id; } @@ -2575,10 +2574,6 @@ C The 'real' name for this user, if any. 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 @@ -2698,7 +2693,11 @@ 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, C, C. +=item In Bugzilla B<5.0>, the following items were added to the bugs return +value: C, C, C. + +=item Since Bugzilla B<6.0>, the email address of users is private and is no +longer returned as part of the user detail hash. =back -- cgit v1.2.3-24-g4f1b