From 2746905570c2056abf9c388cc28c7d1d7b9f5102 Mon Sep 17 00:00:00 2001 From: Michael Kret <88898367+michael-radency@users.noreply.github.com> Date: Mon, 5 Sep 2022 15:57:33 +0300 Subject: [PATCH] fix(Node Gmail): fixed bug related to paired items --- .../nodes-base/nodes/Google/Gmail/Gmail.node.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/nodes-base/nodes/Google/Gmail/Gmail.node.ts b/packages/nodes-base/nodes/Google/Gmail/Gmail.node.ts index e698073472..5a19d02597 100644 --- a/packages/nodes-base/nodes/Google/Gmail/Gmail.node.ts +++ b/packages/nodes-base/nodes/Google/Gmail/Gmail.node.ts @@ -508,7 +508,7 @@ export class Gmail implements INodeType { }; } - responseData = nodeExecutionData; + responseData = [nodeExecutionData]; } if (operation === 'getAll') { const returnAll = this.getNodeParameter('returnAll', i) as boolean; @@ -734,7 +734,7 @@ export class Gmail implements INodeType { }; } - responseData = nodeExecutionData; + responseData = [nodeExecutionData]; } if (operation === 'delete') { // https://developers.google.com/gmail/api/v1/reference/users/drafts/delete @@ -819,17 +819,22 @@ export class Gmail implements INodeType { } let executionData = responseData as INodeExecutionData[]; - if (!['draft', 'message'].includes(resource) && !['get', 'getAll'].includes(operation)) { + + if (!['get', 'getAll'].includes(operation) || resource === 'label') { executionData = this.helpers.constructExecutionMetaData( this.helpers.returnJsonArray(responseData), { itemData: { item: i } }, ); + } else { + executionData = this.helpers.constructExecutionMetaData(executionData, { + itemData: { item: i }, + }); } returnData.push(...executionData); } catch (error) { if (this.continueOnFail()) { - returnData.push({json:{ error: error.message }}); + returnData.push({ json: { error: error.message } }); continue; } throw error;