diff --git a/packages/web-client/src/generated/.openapi-generator/VERSION b/packages/web-client/src/generated/.openapi-generator/VERSION index 89648de3311..66672d4e9d3 100644 --- a/packages/web-client/src/generated/.openapi-generator/VERSION +++ b/packages/web-client/src/generated/.openapi-generator/VERSION @@ -1 +1 @@ -6.0.1-SNAPSHOT \ No newline at end of file +6.1.0-SNAPSHOT \ No newline at end of file diff --git a/packages/web-client/src/generated/api.ts b/packages/web-client/src/generated/api.ts index bb88c07ee07..ebbeb0f67d5 100644 --- a/packages/web-client/src/generated/api.ts +++ b/packages/web-client/src/generated/api.ts @@ -1187,7 +1187,7 @@ export const DrivesApiAxiosParamCreator = function (configuration?: Configuratio const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; - if (ifMatch !== undefined && ifMatch !== null) { + if (ifMatch != null) { localVarHeaderParameter['If-Match'] = String(ifMatch); } @@ -1784,7 +1784,7 @@ export const GroupApiAxiosParamCreator = function (configuration?: Configuration const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; - if (ifMatch !== undefined && ifMatch !== null) { + if (ifMatch != null) { localVarHeaderParameter['If-Match'] = String(ifMatch); } @@ -1827,7 +1827,7 @@ export const GroupApiAxiosParamCreator = function (configuration?: Configuration const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; - if (ifMatch !== undefined && ifMatch !== null) { + if (ifMatch != null) { localVarHeaderParameter['If-Match'] = String(ifMatch); } @@ -2938,10 +2938,12 @@ export const MeUserApiAxiosParamCreator = function (configuration?: Configuratio return { /** * + * @summary Get current user + * @param {Set<'memberOf'>} [$expand] Expand related entities * @param {*} [options] Override http request option. * @throws {RequiredError} */ - meGet: async (options: AxiosRequestConfig = {}): Promise => { + getOwnUser: async ($expand?: Set<'memberOf'>, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/me`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2954,6 +2956,10 @@ export const MeUserApiAxiosParamCreator = function (configuration?: Configuratio const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + if ($expand) { + localVarQueryParameter['$expand'] = Array.from($expand).join(COLLECTION_FORMATS.csv); + } + setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -2977,11 +2983,13 @@ export const MeUserApiFp = function(configuration?: Configuration) { return { /** * + * @summary Get current user + * @param {Set<'memberOf'>} [$expand] Expand related entities * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async meGet(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.meGet(options); + async getOwnUser($expand?: Set<'memberOf'>, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getOwnUser($expand, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } @@ -2996,11 +3004,13 @@ export const MeUserApiFactory = function (configuration?: Configuration, basePat return { /** * + * @summary Get current user + * @param {Set<'memberOf'>} [$expand] Expand related entities * @param {*} [options] Override http request option. * @throws {RequiredError} */ - meGet(options?: any): AxiosPromise { - return localVarFp.meGet(options).then((request) => request(axios, basePath)); + getOwnUser($expand?: Set<'memberOf'>, options?: any): AxiosPromise { + return localVarFp.getOwnUser($expand, options).then((request) => request(axios, basePath)); }, }; }; @@ -3014,12 +3024,14 @@ export const MeUserApiFactory = function (configuration?: Configuration, basePat export class MeUserApi extends BaseAPI { /** * + * @summary Get current user + * @param {Set<'memberOf'>} [$expand] Expand related entities * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MeUserApi */ - public meGet(options?: AxiosRequestConfig) { - return MeUserApiFp(this.configuration).meGet(options).then((request) => request(this.axios, this.basePath)); + public getOwnUser($expand?: Set<'memberOf'>, options?: AxiosRequestConfig) { + return MeUserApiFp(this.configuration).getOwnUser($expand, options).then((request) => request(this.axios, this.basePath)); } } @@ -3054,7 +3066,7 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; - if (ifMatch !== undefined && ifMatch !== null) { + if (ifMatch != null) { localVarHeaderParameter['If-Match'] = String(ifMatch); } diff --git a/packages/web-client/src/generated/common.ts b/packages/web-client/src/generated/common.ts index ecbf41049ca..11571da0cd4 100644 --- a/packages/web-client/src/generated/common.ts +++ b/packages/web-client/src/generated/common.ts @@ -83,24 +83,34 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } diff --git a/packages/web-client/src/graph.ts b/packages/web-client/src/graph.ts index 13c86b60d0e..e24769fb642 100644 --- a/packages/web-client/src/graph.ts +++ b/packages/web-client/src/graph.ts @@ -80,7 +80,7 @@ export const graph = (baseURI: string, axiosClient: AxiosInstance): Graph => { getUser: (userId: string) => userApiFactory.getUser(userId, new Set([]), new Set(['drive'])), createUser: (user: User) => usersApiFactory.createUser(user), - getMe: () => meUserApiFactory.meGet(), + getMe: () => meUserApiFactory.getOwnUser(new Set(['memberOf'])), changeOwnPassword: (currentPassword, newPassword) => meChangepasswordApiFactory.changeOwnPassword({ currentPassword, newPassword }), editUser: (userId: string, user: User) => userApiFactory.updateUser(userId, user), diff --git a/packages/web-runtime/src/pages/account.vue b/packages/web-runtime/src/pages/account.vue index b3d7b56a236..a2198a377f7 100644 --- a/packages/web-runtime/src/pages/account.vue +++ b/packages/web-runtime/src/pages/account.vue @@ -67,15 +67,9 @@ `; diff --git a/packages/web-runtime/tests/unit/pages/account.spec.js b/packages/web-runtime/tests/unit/pages/account.spec.js index 8804bccd58c..81ec570a254 100644 --- a/packages/web-runtime/tests/unit/pages/account.spec.js +++ b/packages/web-runtime/tests/unit/pages/account.spec.js @@ -103,24 +103,16 @@ describe('account page', () => { }) describe('group membership', () => { - it('shows loading indicator when in loading state', () => { - const wrapper = getWrapper() - const groupInfoLoading = wrapper.find(selectors.loaderStub) - expect(groupInfoLoading.exists()).toBeTruthy() - }) it('displays message if not member of any groups', async () => { - const store = getStore() + const store = getStore({ user: { groups: [] } }) const wrapper = getWrapper(store) - await wrapper.setData({ loadingGroups: false }) const groupNamesEmpty = wrapper.find(selectors.groupNamesEmpty) expect(groupNamesEmpty.exists()).toBeTruthy() }) it('displays group names', async () => { - const store = getStore() + const store = getStore({ user: { groups: ['one', 'two', 'three'] } }) const wrapper = getWrapper(store) - await wrapper.setData({ loadingGroups: false }) - await wrapper.setData({ groups: ['one', 'two', 'three'] }) const groupNames = wrapper.find(selectors.groupNames) expect(groupNames).toMatchSnapshot() @@ -184,7 +176,6 @@ function getWrapper(store = getStore()) { $route }, stubs: { - 'oc-spinner': true, 'oc-button': true, 'oc-icon': true }, @@ -208,7 +199,12 @@ function getStore({ setModalInputErrorMessage: jest.fn() }, getters: { - user: () => user, + user: () => { + return { + groups: [], + ...user + } + }, configuration: () => ({ server: server }),