From 81f4322d456773281aec4b47447465bdffd311fe Mon Sep 17 00:00:00 2001 From: Michael Kret <88898367+michael-radency@users.noreply.github.com> Date: Fri, 30 Aug 2024 16:28:25 +0300 Subject: [PATCH] fix(Wait Node): Append n8n attribution option (#10585) --- .../nodes-base/nodes/EmailSend/v2/send.operation.ts | 7 ++----- packages/nodes-base/nodes/Form/common.descriptions.ts | 6 ++++++ .../nodes-base/nodes/Form/v2/FormTriggerV2.node.ts | 11 ++--------- .../nodes/Google/Gmail/v2/MessageDescription.ts | 7 ++----- packages/nodes-base/nodes/Telegram/Telegram.node.ts | 7 ++----- packages/nodes-base/nodes/Wait/Wait.node.ts | 5 +++-- packages/nodes-base/utils/descriptions.ts | 8 ++++++++ 7 files changed, 25 insertions(+), 26 deletions(-) diff --git a/packages/nodes-base/nodes/EmailSend/v2/send.operation.ts b/packages/nodes-base/nodes/EmailSend/v2/send.operation.ts index 7ca8ec82dcc47..0c78e6293c724 100644 --- a/packages/nodes-base/nodes/EmailSend/v2/send.operation.ts +++ b/packages/nodes-base/nodes/EmailSend/v2/send.operation.ts @@ -14,6 +14,7 @@ import { createTransport } from 'nodemailer'; import type SMTPTransport from 'nodemailer/lib/smtp-transport'; import { updateDisplayOptions } from '@utils/utilities'; +import { appendAttributionOption } from '../../../utils/descriptions'; const properties: INodeProperties[] = [ // TODO: Add choice for text as text or html (maybe also from name) @@ -137,11 +138,7 @@ const properties: INodeProperties[] = [ default: {}, options: [ { - // eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased - displayName: 'Append n8n Attribution', - name: 'appendAttribution', - type: 'boolean', - default: true, + ...appendAttributionOption, description: 'Whether to include the phrase “This email was sent automatically with n8n” to the end of the email', }, diff --git a/packages/nodes-base/nodes/Form/common.descriptions.ts b/packages/nodes-base/nodes/Form/common.descriptions.ts index c3505e9509f86..fe777edd83384 100644 --- a/packages/nodes-base/nodes/Form/common.descriptions.ts +++ b/packages/nodes-base/nodes/Form/common.descriptions.ts @@ -1,4 +1,5 @@ import type { INodeProperties } from 'n8n-workflow'; +import { appendAttributionOption } from '../../utils/descriptions'; export const webhookPath: INodeProperties = { displayName: 'Form Path', @@ -314,3 +315,8 @@ export const respondWithOptions: INodeProperties = { }, ], }; + +export const appendAttributionToForm: INodeProperties = { + ...appendAttributionOption, + description: 'Whether to include the link “Form automated with n8n” at the bottom of the form', +}; diff --git a/packages/nodes-base/nodes/Form/v2/FormTriggerV2.node.ts b/packages/nodes-base/nodes/Form/v2/FormTriggerV2.node.ts index fc530d0aebd68..9adead6ad3ef6 100644 --- a/packages/nodes-base/nodes/Form/v2/FormTriggerV2.node.ts +++ b/packages/nodes-base/nodes/Form/v2/FormTriggerV2.node.ts @@ -10,6 +10,7 @@ import { import { formWebhook } from '../utils'; import { + appendAttributionToForm, formDescription, formFields, formRespondMode, @@ -116,15 +117,7 @@ const descriptionV2: INodeTypeDescription = { placeholder: 'Add option', default: {}, options: [ - { - // eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased - displayName: 'Append n8n Attribution', - name: 'appendAttribution', - type: 'boolean', - default: true, - description: - 'Whether to include the link “Form automated with n8n” at the bottom of the form', - }, + appendAttributionToForm, { ...respondWithOptions, displayOptions: { diff --git a/packages/nodes-base/nodes/Google/Gmail/v2/MessageDescription.ts b/packages/nodes-base/nodes/Google/Gmail/v2/MessageDescription.ts index 0378eb04e4a4a..c174bc95f4ea4 100644 --- a/packages/nodes-base/nodes/Google/Gmail/v2/MessageDescription.ts +++ b/packages/nodes-base/nodes/Google/Gmail/v2/MessageDescription.ts @@ -1,4 +1,5 @@ import type { INodeProperties } from 'n8n-workflow'; +import { appendAttributionOption } from '../../../../utils/descriptions'; export const messageOperations: INodeProperties[] = [ { @@ -200,11 +201,7 @@ export const messageFields: INodeProperties[] = [ default: {}, options: [ { - // eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased - displayName: 'Append n8n Attribution', - name: 'appendAttribution', - type: 'boolean', - default: true, + ...appendAttributionOption, description: 'Whether to include the phrase “This email was sent automatically with n8n” to the end of the email', }, diff --git a/packages/nodes-base/nodes/Telegram/Telegram.node.ts b/packages/nodes-base/nodes/Telegram/Telegram.node.ts index 3a1021b8f0a5c..6ecc26ed79709 100644 --- a/packages/nodes-base/nodes/Telegram/Telegram.node.ts +++ b/packages/nodes-base/nodes/Telegram/Telegram.node.ts @@ -11,6 +11,7 @@ import type { import { BINARY_ENCODING, NodeConnectionType, NodeOperationError } from 'n8n-workflow'; import { addAdditionalFields, apiRequest, getPropertyName } from './GenericFunctions'; +import { appendAttributionOption } from '../../utils/descriptions'; export class Telegram implements INodeType { description: INodeTypeDescription = { @@ -1508,11 +1509,7 @@ export class Telegram implements INodeType { default: {}, options: [ { - // eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased - displayName: 'Append n8n Attribution', - name: 'appendAttribution', - type: 'boolean', - default: true, + ...appendAttributionOption, description: 'Whether to include the phrase “This message was sent automatically with n8n” to the end of the message', displayOptions: { diff --git a/packages/nodes-base/nodes/Wait/Wait.node.ts b/packages/nodes-base/nodes/Wait/Wait.node.ts index 9f377df7f914b..5da813981bf4f 100644 --- a/packages/nodes-base/nodes/Wait/Wait.node.ts +++ b/packages/nodes-base/nodes/Wait/Wait.node.ts @@ -27,6 +27,7 @@ import { respondWithOptions, formRespondMode, formTitle, + appendAttributionToForm, } from '../Form/common.descriptions'; import { formWebhook } from '../Form/utils'; import { updateDisplayOptions } from '../../utils/utilities'; @@ -436,7 +437,7 @@ export class Wait extends Webhook { responseMode: ['responseNode'], }, }, - options: [respondWithOptions, webhookSuffix], + options: [appendAttributionToForm, respondWithOptions, webhookSuffix], }, { displayName: 'Options', @@ -452,7 +453,7 @@ export class Wait extends Webhook { responseMode: ['onReceived', 'lastNode'], }, }, - options: [webhookSuffix], + options: [appendAttributionToForm, webhookSuffix], }, ], }; diff --git a/packages/nodes-base/utils/descriptions.ts b/packages/nodes-base/utils/descriptions.ts index fb6772a12bebf..75a1116c81948 100644 --- a/packages/nodes-base/utils/descriptions.ts +++ b/packages/nodes-base/utils/descriptions.ts @@ -41,6 +41,14 @@ export const looseTypeValidationProperty: INodeProperties = { default: true, }; +export const appendAttributionOption: INodeProperties = { + // eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased + displayName: 'Append n8n Attribution', + name: 'appendAttribution', + type: 'boolean', + default: true, +}; + export const encodeDecodeOptions: INodePropertyOptions[] = [ { name: 'armscii8',