From 233a390075fe1ae1686803155611a81b378b7406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Mon, 18 Jan 2021 18:55:07 -0300 Subject: [PATCH] Rename add user operation as create user --- .../nodes/NextCloud/GenericFunctions.ts | 3 +- .../nodes/NextCloud/NextCloud.node.ts | 28 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/packages/nodes-base/nodes/NextCloud/GenericFunctions.ts b/packages/nodes-base/nodes/NextCloud/GenericFunctions.ts index 3f5ca72b80..32481c5118 100644 --- a/packages/nodes-base/nodes/NextCloud/GenericFunctions.ts +++ b/packages/nodes-base/nodes/NextCloud/GenericFunctions.ts @@ -49,10 +49,9 @@ export async function nextCloudApiRequest(this: IHookFunctions | IExecuteFunctio const resource = this.getNodeParameter('resource', 0); const operation = this.getNodeParameter('operation', 0); - if (resource === 'user' && operation === 'add') { + if (resource === 'user' && operation === 'create') { options.uri = options.uri.replace('/remote.php/webdav', ''); } - console.log(options); return await this.helpers.request(options); } else { const credentials = this.getCredentials('nextCloudOAuth2Api'); diff --git a/packages/nodes-base/nodes/NextCloud/NextCloud.node.ts b/packages/nodes-base/nodes/NextCloud/NextCloud.node.ts index 1f05b5b55f..d3c8cc7be1 100644 --- a/packages/nodes-base/nodes/NextCloud/NextCloud.node.ts +++ b/packages/nodes-base/nodes/NextCloud/NextCloud.node.ts @@ -199,12 +199,12 @@ export class NextCloud implements INodeType { }, options: [ { - name: 'Add', - value: 'add', - description: 'Add a user to a NextCloud organization', + name: 'Create', + value: 'Create', + description: 'Invite a user to a NextCloud organization', }, ], - default: 'add', + default: 'create', description: 'The operation to perform.', }, @@ -507,7 +507,7 @@ export class NextCloud implements INodeType { // ---------------------------------- // ---------------------------------- - // user:add + // user:create // ---------------------------------- { displayName: 'User ID', @@ -521,12 +521,12 @@ export class NextCloud implements INodeType { 'user', ], operation: [ - 'add', + 'create', ], }, }, placeholder: 'john', - description: 'The ID of the user to add.', + description: 'The ID of the user to invite.', }, { displayName: 'Email', @@ -540,12 +540,12 @@ export class NextCloud implements INodeType { 'user', ], operation: [ - 'add', + 'create', ], }, }, placeholder: 'john@email.com', - description: 'The email of the user to add.', + description: 'The email of the user to invite.', }, { displayName: 'Additional Fields', @@ -558,7 +558,7 @@ export class NextCloud implements INodeType { 'user', ], operation: [ - 'add', + 'create', ], }, }, @@ -568,7 +568,7 @@ export class NextCloud implements INodeType { name: 'displayName', type: 'string', default: '', - description: 'The display name of the user to add.', + description: 'The display name of the user to invite.', }, ], }, @@ -695,9 +695,9 @@ export class NextCloud implements INodeType { } else if (resource === 'user') { - if (operation === 'add') { + if (operation === 'create') { // ---------------------------------- - // user:add + // user:create // ---------------------------------- requestMethod = 'POST'; @@ -766,7 +766,7 @@ export class NextCloud implements INodeType { items[i].binary![binaryPropertyName] = await this.helpers.prepareBinaryData(responseData, endpoint); - } else if (resource === 'user' && operation === 'add') { + } else if (resource === 'user' && operation === 'create') { const jsonResponseData: IDataObject = await new Promise((resolve, reject) => { parseString(responseData, { explicitArray: false }, (err, data) => {