]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1505831 - Add nick field to all user objects including *_detail returned by ...
authorKohei Yoshino <kohei.yoshino@gmail.com>
Wed, 14 Nov 2018 22:50:26 +0000 (17:50 -0500)
committerGitHub <noreply@github.com>
Wed, 14 Nov 2018 22:50:26 +0000 (17:50 -0500)
Bugzilla/WebService/Bug.pm
Bugzilla/WebService/Group.pm
Bugzilla/WebService/User.pm
docs/en/rst/api/core/v1/bug.rst
docs/en/rst/api/core/v1/flag-activity.rst
docs/en/rst/api/core/v1/group.rst
docs/en/rst/api/core/v1/user.rst
extensions/Review/lib/WebService.pm
qa/t/webservice_user_get.t

index f13998e4379d26281c47fb9398dac3eec5effb57..5d60885c9d062fa28f18e3e2dfc873d7f06cdbf1 100644 (file)
@@ -1548,6 +1548,7 @@ sub _user_to_hash {
     my $item = filter $filters, {
         id        => $self->type('int', $user->id),
         real_name => $self->type('string', $user->name),
+        nick      => $self->type('string', $user->nick),
         name      => $self->type('email', $user->login),
         email     => $self->type('email', $user->email),
     }, $types, $prefix;
@@ -2849,6 +2850,11 @@ C<int> The user id for this user.
 
 C<string> The 'real' name for this user, if any.
 
+=item C<nick>
+
+C<string> The user's nickname. Currently this is extracted from the real_name,
+name or email field.
+
 =item C<name>
 
 C<string> The user's Bugzilla login.
index b13003e086cf5e75cee1203529b35e984c953ce0..88e7a1ed4b251823707248532f9d3d368b4c0d70 100644 (file)
@@ -210,6 +210,7 @@ sub _get_group_membership {
         map {{
             id                => $self->type('int', $_->id),
             real_name         => $self->type('string', $_->name),
+            nick              => $self->type('string', $_->nick),
             name              => $self->type('string', $_->login),
             email             => $self->type('string', $_->email),
             can_login         => $self->type('boolean', $_->is_enabled),
@@ -547,6 +548,11 @@ C<int> The id of the user.
 
 C<string> The actual name of the user.
 
+=item nick
+
+C<string> The user's nickname. Currently this is extracted from the real_name,
+name or email field.
+
 =item email
 
 C<string> The email address of the user.
index c569cf9d858fbd72a631d2ac3715fc230526aaa2..758baf0f95e62120b2b8dbd9e01c307071737396 100644 (file)
@@ -192,6 +192,7 @@ sub suggest {
         {
             id        => $self->type(int    => $_->{id}),
             real_name => $self->type(string => $_->{real_name}),
+            nick      => $self->type(string => $_->{nick}),
             name      => $self->type(email  => $_->{name}),
         }
     } @$results;
@@ -240,6 +241,7 @@ sub get {
         @users = map { filter $params, {
                      id        => $self->type('int', $_->id),
                      real_name => $self->type('string', $_->name),
+                     nick      => $self->type('string', $_->nick),
                      name      => $self->type('email', $_->login),
                  } } @$in_group;
 
@@ -290,6 +292,7 @@ sub get {
         my $user_info = filter $params, {
             id        => $self->type('int', $user->id),
             real_name => $self->type('string', $user->name),
+            nick      => $self->type('string', $user->nick),
             name      => $self->type('email', $user->login),
             email     => $self->type('email', $user->email),
             can_login => $self->type('boolean', $user->is_enabled ? 1 : 0),
@@ -496,6 +499,7 @@ sub whoami {
         {
             id         => $self->type( 'int',     $user->id ),
             real_name  => $self->type( 'string',  $user->name ),
+            nick       => $self->type( 'string',  $user->nick ),
             name       => $self->type( 'email',   $user->login ),
             mfa_status => $self->type( 'boolean', !!$user->mfa ),
         }
@@ -1026,6 +1030,11 @@ Even if the user's login name changes, this will not change.
 
 C<string> The actual name of the user. May be blank.
 
+=item nick
+
+C<string> The user's nickname. Currently this is extracted from the real_name,
+name or email field.
+
 =item email
 
 C<string> The email address of the user.
@@ -1100,10 +1109,10 @@ name of each saved search.
 =back
 
 B<Note>: If you are not logged in to Bugzilla when you call this function, you
-will only be returned the C<id>, C<name>, and C<real_name> items. If you are
-logged in and not in editusers group, you will only be returned the C<id>, C<name>,
-C<real_name>, C<email>, and C<can_login> items. The groups returned are filtered
-based on your permission to bless each group.
+will only be returned the C<id>, C<name>, C<real_name> and C<nick> items. If you
+are logged in and not in editusers group, you will only be returned the C<id>,
+C<name>, C<real_name>, C<nick>, C<email> and C<can_login> items. The groups
+returned are filtered based on your permission to bless each group.
 
 =back
 
@@ -1151,6 +1160,8 @@ for C<match> has changed to only returning enabled accounts.
 =item Error 804 has been added in Bugzilla 4.0.9 and 4.2.4. It's now
 illegal to pass a group name you don't belong to.
 
+=item C<nick> Added in Bugzilla B<6.0>.
+
 =back
 
 =item REST API call added in Bugzilla B<5.0>.
@@ -1184,6 +1195,11 @@ Even if the user's login name changes, this will not change.
 
 C<string> The actual name of the user. May be blank.
 
+=item nick
+
+C<string> The user's nickname. Currently this is extracted from the real_name,
+name or email field.
+
 =item name
 
 C<string> The login name of the user.
index 9ce7fc45475a68234832b2148637257a2e9b0f1c..4b77c9864654f3b3acf9de04c356bacce179d9ac 100644 (file)
@@ -45,6 +45,7 @@ name              type   description
          "assigned_to_detail": {
            "id": 2,
            "real_name": "Test User",
+           "nick": "user",
            "name": "user@bugzilla.org",
            "email": "user@bugzilla.org"
          },
@@ -76,6 +77,7 @@ name              type   description
            {
              "id": 786,
              "real_name": "Foo Bar",
+             "nick": "foo",
              "name": "foo@bar.com",
              "email": "foo@bar.com"
            },
@@ -113,6 +115,7 @@ name              type   description
          "creator_detail": {
            "id": 28,
            "real_name": "hello",
+           "nick": "namachi",
            "name": "user@bugzilla.org",
            "email": "namachi@netscape.com"
          },
@@ -260,6 +263,8 @@ name       type    description
 =========  ======  ==============================================================
 id         int     The user ID for this user.
 real_name  string  The 'real' name for this user, if any.
+nick       string  The user's nickname. Currently this is extracted from the
+                   real_name, name or email field.
 name       string  The user's Bugzilla login.
 email      string  The user's email address. Currently this is the same value as
                    the name.
index 4ce08173a097d2089fa05de309c08bb17102454f..4a8a2cb7f1bae75c745d4c8c5bbc0225c4bd469b 100644 (file)
@@ -83,11 +83,13 @@ For example, to get the first 100 flag-activity entries that occurred on or afte
        "requestee": {
          "id": 123,
          "name": "user@mozilla.com",
+         "nick": "user",
          "real_name": "J. Random User"
        },
        "setter": {
          "id": 123,
          "name": "user@mozilla.com",
+         "nick": "user",
          "real_name": "J. Random User"
        },
        "status": "?",
@@ -127,6 +129,8 @@ name       type    description
 id         int     The unique ID of the user.
 name       string  The login of the user (typically an email address).
 real_name  string  The real name of the user, if set.
+nick       string  The user's nickname. Currently this is extracted
+                   the real_name, name or email field.
 =========  ======  ====================================================
 
 The type object has the following fields:
index 13367e392e397e8023b1129c0169ca4f40ded89a..e5b24b8c9db15b9f5ab6b53484c1146d6cfd0862 100644 (file)
@@ -223,6 +223,7 @@ membership  boolean  Set to 1 then a list of members of the passed groups names
          "membership": [
            {
              "real_name": "Bugzilla User",
+             "nick": "user",
              "can_login": true,
              "name": "user@bugzilla.org",
              "login_denied_text": "",
@@ -280,6 +281,8 @@ name           type     description
 =============  =======  =========================================================
 id             int      The ID of the user.
 real_name      string   The actual name of the user.
+nick           string   The user's nickname. Currently this is extracted from
+                        the real_name, name or email field.
 email          string   The email address of the user.
 name           string   The login name of the user. Note that in some situations
                         this is different than their email.
index bc5459892199236ae3b3b630901db25c0d147ad0..1565425e5a0e1af29a6534d65405753be4a31796 100644 (file)
@@ -352,6 +352,8 @@ id                 int      The unique integer ID that Bugzilla uses to represen
                             this user. Even if the user's login name changes,
                             this will not change.
 real_name          string   The actual name of the user. May be blank.
+nick               string   The user's nickname. Currently this is extracted from
+                            the real_name, name or email field.
 email              string   The email address of the user.
 name               string   The login name of the user. Note that in some
                             situations this is different than their email.
@@ -398,11 +400,11 @@ query  string  The CGI parameters for the saved report.
 =====  ======  ==================================================================
 
 If you are not authenticated when you call this function, you will only be
-returned the ``id``, ``name``, and ``real_name`` items. If you are authenticated
-and not in 'editusers' group, you will only be returned the ``id``, ``name``,
-``real_name``, ``email``, ``can_login``, and ``groups`` items. The groups
-returned are filtered based on your permission to bless each group. The
-``saved_searches`` and ``saved_reports`` items are only returned if you are
+returned the ``id``, ``name``, ``real_name`` and ``nick`` items. If you are
+authenticated and not in 'editusers' group, you will only be returned the ``id``,
+``name``, ``real_name``, ``nick``, ``email``, ``can_login`` and ``groups`` items.
+The groups returned are filtered based on your permission to bless each group.
+The ``saved_searches`` and ``saved_reports`` items are only returned if you are
 querying your own account, even if you are in the editusers group.
 
 **Errors**
@@ -445,6 +447,7 @@ logged in user.
      "id" : "1234",
      "name" : "user@bugzulla.org",
      "real_name" : "Test User",
+     "nick" : "user"
    }
 
 ========== ======  =====================================================
@@ -454,5 +457,7 @@ id         int     The unique integer ID that Bugzilla uses to represent
                    this user. Even if the user's login name changes,
                    this will not change.
 real_name  string  The actual name of the user. May be blank.
+nick       string  The user's nickname. Currently this is extracted from
+                   the real_name, name or email field.
 name       string  string  The login name of the user.
 ========== ======  =====================================================
index fe3e526631a360443d744089aae65efbb6df673f..a8dfb2b43d43c5dbc5cf5cb1db2440913525f55a 100644 (file)
@@ -71,6 +71,7 @@ sub suggestions {
             id    => $self->type('int', $reviewer->id),
             email => $self->type('email', $reviewer->login),
             name  => $self->type('string', $reviewer->name),
+            nick  => $self->type('string', $reviewer->nick),
             review_count => $self->type('int', $reviewer->review_count),
         };
     }
@@ -289,6 +290,7 @@ sub _user_to_hash {
     return {
         id        => $self->type('int',    $user->id),
         real_name => $self->type('string', $user->name),
+        nick      => $self->type('string', $user->nick),
         name      => $self->type('email',  $user->login),
     };
 }
@@ -489,6 +491,11 @@ The id of the bugzilla user. A unique integer value.
 
 The real name of the bugzilla user.
 
+=item C<nick> (string)
+
+The user's nickname. Currently this is extracted from the real_name, name or
+email field.
+
 =item C<name> (string)
 
 The bugzilla login of the bugzilla user (typically an email address).
index 4a7f74f7823b40810a51bdf9ef8f4ef61228751f..32f25f256a7ccf27507188d9910b22837ad7b701 100644 (file)
@@ -141,8 +141,8 @@ sub post_success {
     }
     else {
         my @item_keys = sort keys %$item;
-        is_deeply(\@item_keys, ['id', 'name', 'real_name'],
-            'Only id, name, and real_name are returned to logged-out users');
+        is_deeply(\@item_keys, ['id', 'name', 'nick', 'real_name'],
+            'Only id, name, nick and real_name are returned to logged-out users');
         return;
     }
 
@@ -198,14 +198,14 @@ foreach my $rpc (@clients) {
     my $exclude_none = $rpc->bz_call_success('User.get', {
         names => [$get_user], exclude_fields => ['asdfasdfsdf'],
     }, 'User.get excluding only invalid fields');
-    is(scalar keys %{ $exclude_none->result->{users}->[0] }, 3,
+    is(scalar keys %{ $exclude_none->result->{users}->[0] }, 4,
        'All fields returned for user');
 
     my $exclude_one = $rpc->bz_call_success('User.get', {
         names => [$get_user], exclude_fields => ['id'],
     }, 'User.get excluding id');
-    is(scalar keys %{ $exclude_one->result->{users}->[0] }, 2,
-       'Only two fields returned for user');
+    is(scalar keys %{ $exclude_one->result->{users}->[0] }, 3,
+       'Only three fields returned for user');
 
     my $override = $rpc->bz_call_success('User.get', {
         names => [$get_user], include_fields => ['id', 'name'],