Skip to content

Commit

Permalink
fix(Node Gmail): fixed bug related to paired items
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-radency authored Sep 5, 2022
1 parent 71cae90 commit 2746905
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/nodes-base/nodes/Google/Gmail/Gmail.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ export class Gmail implements INodeType {
};
}

responseData = nodeExecutionData;
responseData = [nodeExecutionData];
}
if (operation === 'getAll') {
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2746905

Please sign in to comment.