From e3bc4b9052577417f8bb712beb925fe86b674eeb Mon Sep 17 00:00:00 2001 From: Rupenieks Date: Mon, 25 May 2020 09:19:06 +0200 Subject: [PATCH 1/5] User / Stream update fix --- packages/nodes-base/nodes/Zulip/Zulip.node.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nodes-base/nodes/Zulip/Zulip.node.ts b/packages/nodes-base/nodes/Zulip/Zulip.node.ts index 5dbcc6771..14de8131d 100644 --- a/packages/nodes-base/nodes/Zulip/Zulip.node.ts +++ b/packages/nodes-base/nodes/Zulip/Zulip.node.ts @@ -343,10 +343,10 @@ export class Zulip implements INodeType { const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; if (additionalFields.description) { - body.description = additionalFields.description as string; + body.description = JSON.stringify(additionalFields.description as string); } if (additionalFields.newName) { - body.new_name = additionalFields.newName as string; + body.new_name = JSON.stringify(additionalFields.newName as string); } if (additionalFields.isPrivate) { body.is_private = additionalFields.isPrivate as boolean; @@ -412,7 +412,7 @@ export class Zulip implements INodeType { const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; if (additionalFields.fullName) { - body.full_name = additionalFields.fullName as string; + body.full_name = JSON.stringify(additionalFields.fullName as string); } if (additionalFields.isAdmin) { body.is_admin = additionalFields.isAdmin as boolean; From 4ec8a2b44c976d5848268947c2e0321ae20952d3 Mon Sep 17 00:00:00 2001 From: Rupenieks Date: Mon, 25 May 2020 09:24:07 +0200 Subject: [PATCH 2/5] Fixed duplicated response Data --- packages/nodes-base/nodes/Zulip/Zulip.node.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nodes-base/nodes/Zulip/Zulip.node.ts b/packages/nodes-base/nodes/Zulip/Zulip.node.ts index 14de8131d..d86d9c7ec 100644 --- a/packages/nodes-base/nodes/Zulip/Zulip.node.ts +++ b/packages/nodes-base/nodes/Zulip/Zulip.node.ts @@ -439,11 +439,11 @@ export class Zulip implements INodeType { returnData.push.apply(returnData, responseData.members as IDataObject[]); } - if (responseData.streams) { + else if (responseData.streams) { returnData.push.apply(returnData, responseData.streams as IDataObject[]); } - if (responseData.subscriptions) { + else if (responseData.subscriptions) { returnData.push.apply(returnData, responseData.subscriptions as IDataObject[]); } else { From bb2f1ecd00288af2ab009e7fb1c50ef899d29059 Mon Sep 17 00:00:00 2001 From: Rupenieks Date: Mon, 25 May 2020 09:36:47 +0200 Subject: [PATCH 3/5] Subscriptions now front view --- .../nodes/Zulip/StreamDescription.ts | 79 +++++++++++-------- packages/nodes-base/nodes/Zulip/Zulip.node.ts | 8 +- 2 files changed, 49 insertions(+), 38 deletions(-) diff --git a/packages/nodes-base/nodes/Zulip/StreamDescription.ts b/packages/nodes-base/nodes/Zulip/StreamDescription.ts index 777ae7ba6..9244ff52a 100644 --- a/packages/nodes-base/nodes/Zulip/StreamDescription.ts +++ b/packages/nodes-base/nodes/Zulip/StreamDescription.ts @@ -48,6 +48,51 @@ export const streamFields = [ /* -------------------------------------------------------------------------- */ /* stream:create */ /* -------------------------------------------------------------------------- */ + { + displayName: 'Subscriptions', + name: 'subscriptions', + type: 'fixedCollection', + required: true, + default: '', + description: 'A list of dictionaries containing the the key name and value specifying the name of the stream to subscribe. If the stream does not exist a new stream is created.', + displayOptions: { + show: { + resource: [ + 'stream', + ], + operation: [ + 'create', + ], + }, + }, + typeOptions: { + multipleValues: true, + }, + options: [ + { + displayName: 'Subscription Properties', + name: 'properties', + values: [ + { + displayName: 'Name', + name: 'name', + type: 'string', + required: true, + default: '', + description: 'Name of Subscription.', + }, + { + displayName: 'Description', + name: 'description', + type: 'string', + required: true, + default: '', + description: 'Description of Subscription.', + } + ], + }, + ], + }, { displayName: 'JSON Parameters', name: 'jsonParameters', @@ -162,40 +207,6 @@ export const streamFields = [ }, ], }, - { - displayName: 'Subscriptions', - name: 'subscriptions', - type: 'fixedCollection', - required: true, - description: '"A list of dictionaries containing the the key name and value specifying the name of the stream to subscribe. If the stream does not exist a new stream is created.', - typeOptions: { - multipleValues: true, - }, - options: [ - { - displayName: 'Subscription Properties', - name: 'properties', - values: [ - { - displayName: 'Name', - name: 'name', - type: 'string', - required: true, - default: '', - description: 'Name of Subscription.', - }, - { - displayName: 'Description', - name: 'description', - type: 'string', - required: true, - default: '', - description: 'Description of Subscription.', - } - ], - }, - ], - }, { displayName: 'Stream Post Policy', name: 'streamPostPolicy', diff --git a/packages/nodes-base/nodes/Zulip/Zulip.node.ts b/packages/nodes-base/nodes/Zulip/Zulip.node.ts index d86d9c7ec..1d336bf0d 100644 --- a/packages/nodes-base/nodes/Zulip/Zulip.node.ts +++ b/packages/nodes-base/nodes/Zulip/Zulip.node.ts @@ -262,7 +262,11 @@ export class Zulip implements INodeType { if (operation === 'create') { const jsonParameters = this.getNodeParameter('jsonParameters', i) as boolean; + const subscriptions = this.getNodeParameter('subscriptions', i) as IDataObject[]; + //@ts-ignore + body.subscriptions = JSON.stringify(subscriptions.properties); + if (jsonParameters) { const additionalFieldsJson = this.getNodeParameter('additionalFieldsJson', i) as string; @@ -281,10 +285,6 @@ export class Zulip implements INodeType { const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; - if (additionalFields.subscriptions) { - //@ts-ignore - body.subscriptions = JSON.stringify(additionalFields.subscriptions.properties); - } if (additionalFields.inviteOnly) { body.invite_only = additionalFields.inviteOnly as boolean; } From b600e5b094aa8cfa2c9884cd78e67cff79288335 Mon Sep 17 00:00:00 2001 From: Rupenieks Date: Mon, 25 May 2020 09:38:10 +0200 Subject: [PATCH 4/5] missing defaults added to fixedCollection --- packages/nodes-base/nodes/Zulip/StreamDescription.ts | 3 ++- packages/nodes-base/nodes/Zulip/UserDescription.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/Zulip/StreamDescription.ts b/packages/nodes-base/nodes/Zulip/StreamDescription.ts index 9244ff52a..195cce632 100644 --- a/packages/nodes-base/nodes/Zulip/StreamDescription.ts +++ b/packages/nodes-base/nodes/Zulip/StreamDescription.ts @@ -185,7 +185,8 @@ export const streamFields = [ { displayName: 'Principals', name: 'principals', - type: 'fixedCollection', + type: 'fixedCollection', + default: '', description: 'A list of email addresses of the users that will be subscribed/unsubscribed to the streams specified in the subscriptions argument. If not provided, then the requesting user/bot is subscribed.', typeOptions: { multipleValues: true, diff --git a/packages/nodes-base/nodes/Zulip/UserDescription.ts b/packages/nodes-base/nodes/Zulip/UserDescription.ts index 1ae3269d3..b873088b3 100644 --- a/packages/nodes-base/nodes/Zulip/UserDescription.ts +++ b/packages/nodes-base/nodes/Zulip/UserDescription.ts @@ -237,6 +237,7 @@ export const userFields = [ displayName: 'Profile Data', name: 'profileData', type: 'fixedCollection', + default: '', description: 'A dictionary containing the to be updated custom profile field data for the user.', typeOptions: { multipleValues: true, From 606a5fa98f600a4587d3c4328a9790e1fd3cf7fa Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Sun, 31 May 2020 11:15:45 +0200 Subject: [PATCH 5/5] :zap: Fix some issues with Zulip --- .../nodes/Zulip/StreamDescription.ts | 55 ++----------------- .../nodes-base/nodes/Zulip/UserDescription.ts | 10 ++-- packages/nodes-base/nodes/Zulip/Zulip.node.ts | 3 +- 3 files changed, 11 insertions(+), 57 deletions(-) diff --git a/packages/nodes-base/nodes/Zulip/StreamDescription.ts b/packages/nodes-base/nodes/Zulip/StreamDescription.ts index c5969af4e..27c9c1044 100644 --- a/packages/nodes-base/nodes/Zulip/StreamDescription.ts +++ b/packages/nodes-base/nodes/Zulip/StreamDescription.ts @@ -33,11 +33,11 @@ export const streamOperations = [ value: 'getSubscribed', description: 'Get subscribed streams.', }, - // { - // name: 'Update', - // value: 'update', - // description: 'Update a stream.', - // }, + { + name: 'Update', + value: 'update', + description: 'Update a stream.', + }, ], default: 'create', description: 'The operation to perform.', @@ -48,51 +48,6 @@ export const streamFields = [ /* -------------------------------------------------------------------------- */ /* stream:create */ /* -------------------------------------------------------------------------- */ - { - displayName: 'Subscriptions', - name: 'subscriptions', - type: 'fixedCollection', - required: true, - default: '', - description: 'A list of dictionaries containing the the key name and value specifying the name of the stream to subscribe. If the stream does not exist a new stream is created.', - displayOptions: { - show: { - resource: [ - 'stream', - ], - operation: [ - 'create', - ], - }, - }, - typeOptions: { - multipleValues: true, - }, - options: [ - { - displayName: 'Subscription Properties', - name: 'properties', - values: [ - { - displayName: 'Name', - name: 'name', - type: 'string', - required: true, - default: '', - description: 'Name of Subscription.', - }, - { - displayName: 'Description', - name: 'description', - type: 'string', - required: true, - default: '', - description: 'Description of Subscription.', - } - ], - }, - ], - }, { displayName: 'JSON Parameters', name: 'jsonParameters', diff --git a/packages/nodes-base/nodes/Zulip/UserDescription.ts b/packages/nodes-base/nodes/Zulip/UserDescription.ts index 5a30b9c0a..8ca33bad1 100644 --- a/packages/nodes-base/nodes/Zulip/UserDescription.ts +++ b/packages/nodes-base/nodes/Zulip/UserDescription.ts @@ -33,11 +33,11 @@ export const userOperations = [ value: 'getAll', description: 'Get all users.', }, - // { - // name: 'Update', - // value: 'update', - // description: 'Update a user.', - // }, + { + name: 'Update', + value: 'update', + description: 'Update a user.', + }, ], default: 'create', description: 'The operation to perform.', diff --git a/packages/nodes-base/nodes/Zulip/Zulip.node.ts b/packages/nodes-base/nodes/Zulip/Zulip.node.ts index 625f60f23..3c6261a37 100644 --- a/packages/nodes-base/nodes/Zulip/Zulip.node.ts +++ b/packages/nodes-base/nodes/Zulip/Zulip.node.ts @@ -263,9 +263,8 @@ export class Zulip implements INodeType { if (operation === 'create') { const jsonParameters = this.getNodeParameter('jsonParameters', i) as boolean; - const subscriptions = this.getNodeParameter('subscriptions', i) as IDataObject[]; + const subscriptions = this.getNodeParameter('subscriptions', i) as IDataObject; - //@ts-ignore body.subscriptions = JSON.stringify(subscriptions.properties); if (jsonParameters) {