Commit 9169e263 authored by Mario Celi's avatar Mario Celi Committed by Alex Kalderimis

Add namespace field to User type in GraphQL

The namespace field represents the personal namespace of a user

Changelog: added
parent 8b030d4c
......@@ -77,6 +77,10 @@ module Types
field :starred_projects,
description: 'Projects starred by the user.',
resolver: Resolvers::UserStarredProjectsResolver
field :namespace,
type: Types::NamespaceType,
null: true,
description: 'Personal namespace of the user.'
field :todos, resolver: Resolvers::TodoResolver, description: 'To-do items of the user.' do
extension(::Gitlab::Graphql::TodosProjectPermissionPreloader::FieldExtension)
......
......@@ -10677,6 +10677,7 @@ A user assigned to a merge request.
| <a id="mergerequestassigneelocation"></a>`location` | [`String`](#string) | The location of the user. |
| <a id="mergerequestassigneemergerequestinteraction"></a>`mergeRequestInteraction` | [`UserMergeRequestInteraction`](#usermergerequestinteraction) | Details of this user's interactions with the merge request. |
| <a id="mergerequestassigneename"></a>`name` | [`String!`](#string) | Human-readable name of the user. |
| <a id="mergerequestassigneenamespace"></a>`namespace` | [`Namespace`](#namespace) | Personal namespace of the user. |
| <a id="mergerequestassigneeprojectmemberships"></a>`projectMemberships` | [`ProjectMemberConnection`](#projectmemberconnection) | Project memberships of the user. (see [Connections](#connections)) |
| <a id="mergerequestassigneepublicemail"></a>`publicEmail` | [`String`](#string) | User's public email. |
| <a id="mergerequestassigneestate"></a>`state` | [`UserState!`](#userstate) | State of the user. |
......@@ -10883,6 +10884,7 @@ A user assigned to a merge request as a reviewer.
| <a id="mergerequestreviewerlocation"></a>`location` | [`String`](#string) | The location of the user. |
| <a id="mergerequestreviewermergerequestinteraction"></a>`mergeRequestInteraction` | [`UserMergeRequestInteraction`](#usermergerequestinteraction) | Details of this user's interactions with the merge request. |
| <a id="mergerequestreviewername"></a>`name` | [`String!`](#string) | Human-readable name of the user. |
| <a id="mergerequestreviewernamespace"></a>`namespace` | [`Namespace`](#namespace) | Personal namespace of the user. |
| <a id="mergerequestreviewerprojectmemberships"></a>`projectMemberships` | [`ProjectMemberConnection`](#projectmemberconnection) | Project memberships of the user. (see [Connections](#connections)) |
| <a id="mergerequestreviewerpublicemail"></a>`publicEmail` | [`String`](#string) | User's public email. |
| <a id="mergerequestreviewerstate"></a>`state` | [`UserState!`](#userstate) | State of the user. |
......@@ -13658,6 +13660,7 @@ Core represention of a GitLab user.
| <a id="usercoreid"></a>`id` | [`ID!`](#id) | ID of the user. |
| <a id="usercorelocation"></a>`location` | [`String`](#string) | The location of the user. |
| <a id="usercorename"></a>`name` | [`String!`](#string) | Human-readable name of the user. |
| <a id="usercorenamespace"></a>`namespace` | [`Namespace`](#namespace) | Personal namespace of the user. |
| <a id="usercoreprojectmemberships"></a>`projectMemberships` | [`ProjectMemberConnection`](#projectmemberconnection) | Project memberships of the user. (see [Connections](#connections)) |
| <a id="usercorepublicemail"></a>`publicEmail` | [`String`](#string) | User's public email. |
| <a id="usercorestate"></a>`state` | [`UserState!`](#userstate) | State of the user. |
......@@ -16510,6 +16513,7 @@ Implementations:
| <a id="userid"></a>`id` | [`ID!`](#id) | ID of the user. |
| <a id="userlocation"></a>`location` | [`String`](#string) | The location of the user. |
| <a id="username"></a>`name` | [`String!`](#string) | Human-readable name of the user. |
| <a id="usernamespace"></a>`namespace` | [`Namespace`](#namespace) | Personal namespace of the user. |
| <a id="userprojectmemberships"></a>`projectMemberships` | [`ProjectMemberConnection`](#projectmemberconnection) | Project memberships of the user. (see [Connections](#connections)) |
| <a id="userpublicemail"></a>`publicEmail` | [`String`](#string) | User's public email. |
| <a id="userstate"></a>`state` | [`UserState!`](#userstate) | State of the user. |
......
......@@ -31,6 +31,7 @@ RSpec.describe GitlabSchema.types['MergeRequestReviewer'] do
starredProjects
callouts
merge_request_interaction
namespace
]
expect(described_class).to have_graphql_fields(*expected_fields)
......
......@@ -36,6 +36,7 @@ RSpec.describe GitlabSchema.types['User'] do
projectMemberships
starredProjects
callouts
namespace
]
expect(described_class).to have_graphql_fields(*expected_fields)
......
......@@ -5,8 +5,15 @@ require 'spec_helper'
RSpec.describe 'getting project information' do
include GraphqlHelpers
let(:fields) do
<<~GRAPHQL
name
namespace { id }
GRAPHQL
end
let(:query) do
graphql_query_for('currentUser', {}, 'name')
graphql_query_for('currentUser', {}, fields)
end
subject { graphql_data['currentUser'] }
......@@ -20,7 +27,7 @@ RSpec.describe 'getting project information' do
it_behaves_like 'a working graphql query'
it { is_expected.to include('name' => current_user.name) }
it { is_expected.to include('name' => current_user.name, 'namespace' => { 'id' => current_user.namespace.to_global_id.to_s }) }
end
context 'when there is no current_user' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment