mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix(Discord Node): Remove unnecessary requirement on parameters (#8060)
## Summary The PR removes the requirement on 2 fields: the `content` and the `description` of embeds. Discord requires neither of these fields and as they weren't required in the v1 node, it prevents migrating to the v2 node for users not providing one of them. Discord does require *something* to be sent however, whether an attachment, an embed or content, so this could be used instead if necessary. ## Review / Merge checklist - [x] PR title and summary are descriptive. **Remember, the title automatically goes into the changelog. Use `(no-changelog)` otherwise.** ([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md)) - [x] ~~[Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up ticket created.~~ (v2 is not documented) - [x] ~~Tests included.~~ (If more complex requirements are set then a test should be added although I haven't worked with n8n's tests before) --------- Co-authored-by: Michael Kret <michael.k@radency.com> Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
This commit is contained in:
parent
3b6ae2d0a5
commit
ef3a57719e
|
@ -297,7 +297,7 @@ export const simplifyBoolean: INodeProperties = {
|
||||||
// embeds -----------------------------------------------------------------------------------------
|
// embeds -----------------------------------------------------------------------------------------
|
||||||
const embedFields: INodeProperties[] = [
|
const embedFields: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
displayName: 'Description (Required)',
|
displayName: 'Description',
|
||||||
name: 'description',
|
name: 'description',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
|
|
|
@ -63,7 +63,6 @@ const properties: INodeProperties[] = [
|
||||||
name: 'content',
|
name: 'content',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
required: true,
|
|
||||||
description: 'The content of the message (up to 2000 characters)',
|
description: 'The content of the message (up to 2000 characters)',
|
||||||
placeholder: 'e.g. My message',
|
placeholder: 'e.g. My message',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
|
|
|
@ -71,6 +71,11 @@ export function parseDiscordError(this: IExecuteFunctions, error: any, itemIndex
|
||||||
|
|
||||||
return new NodeOperationError(this.getNode(), errorData.errors, errorOptions);
|
return new NodeOperationError(this.getNode(), errorData.errors, errorOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errorOptions.message === 'Cannot send an empty message') {
|
||||||
|
errorOptions.description =
|
||||||
|
'Something has to be send to the channel whether it is a message, an embed or a file';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return new NodeOperationError(this.getNode(), errorData || error, errorOptions);
|
return new NodeOperationError(this.getNode(), errorData || error, errorOptions);
|
||||||
}
|
}
|
||||||
|
@ -133,13 +138,6 @@ export function prepareEmbeds(this: IExecuteFunctions, embeds: IDataObject[], i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!embedReturnData.description) {
|
|
||||||
throw new NodeOperationError(
|
|
||||||
this.getNode(),
|
|
||||||
`Description is required, embed ${index} in item ${i} is missing it`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (embedReturnData.author) {
|
if (embedReturnData.author) {
|
||||||
embedReturnData.author = {
|
embedReturnData.author = {
|
||||||
name: embedReturnData.author,
|
name: embedReturnData.author,
|
||||||
|
|
Loading…
Reference in a new issue