feat(core): Add "Sent by n8n" attribution (#7183)

Github issue / Community forum post (link here to close automatically):

---------

Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
This commit is contained in:
Michael Kret
2023-10-03 11:18:59 +03:00
committed by GitHub
parent f0a66873b9
commit 8f9fe6269b
20 changed files with 345 additions and 57 deletions

View File

@@ -39,7 +39,7 @@ const versionDescription: INodeTypeDescription = {
name: 'gmail',
icon: 'file:gmail.svg',
group: ['transform'],
version: 2,
version: [2, 2.1],
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Consume the Gmail API',
defaults: {
@@ -205,6 +205,8 @@ export class GmailV2 implements INodeType {
const returnData: INodeExecutionData[] = [];
const resource = this.getNodeParameter('resource', 0);
const operation = this.getNodeParameter('operation', 0);
const nodeVersion = this.getNode().typeVersion;
const instanceId = await this.getInstanceId();
let responseData;
@@ -323,6 +325,11 @@ export class GmailV2 implements INodeType {
from = `${options.senderName as string} <${emailAddress}>`;
}
let appendAttribution = options.appendAttribution;
if (appendAttribution === undefined) {
appendAttribution = nodeVersion >= 2.1;
}
const email: IEmail = {
from,
to,
@@ -330,7 +337,7 @@ export class GmailV2 implements INodeType {
bcc,
replyTo,
subject: this.getNodeParameter('subject', i) as string,
...prepareEmailBody.call(this, i),
...prepareEmailBody.call(this, i, appendAttribution as boolean, instanceId),
attachments,
};