mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix: Do not trigger sendAndWait response on bot visit if response type is approval (#13792)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import isbot from 'isbot';
|
||||
import {
|
||||
NodeOperationError,
|
||||
SEND_AND_WAIT_OPERATION,
|
||||
@@ -324,11 +325,18 @@ const getFormResponseCustomizations = (context: IWebhookFunctions) => {
|
||||
export async function sendAndWaitWebhook(this: IWebhookFunctions) {
|
||||
const method = this.getRequestObject().method;
|
||||
const res = this.getResponseObject();
|
||||
const req = this.getRequestObject();
|
||||
|
||||
const responseType = this.getNodeParameter('responseType', 'approval') as
|
||||
| 'approval'
|
||||
| 'freeText'
|
||||
| 'customForm';
|
||||
|
||||
if (responseType === 'approval' && isbot(req.headers['user-agent'])) {
|
||||
res.send('');
|
||||
return { noWebhookResponse: true };
|
||||
}
|
||||
|
||||
if (responseType === 'freeText') {
|
||||
if (method === 'GET') {
|
||||
const { formTitle, formDescription, buttonLabel } = getFormResponseCustomizations(this);
|
||||
@@ -424,7 +432,7 @@ export async function sendAndWaitWebhook(this: IWebhookFunctions) {
|
||||
}
|
||||
}
|
||||
|
||||
const query = this.getRequestObject().query as { approved: 'false' | 'true' };
|
||||
const query = req.query as { approved: 'false' | 'true' };
|
||||
const approved = query.approved === 'true';
|
||||
return {
|
||||
webhookResponse: ACTION_RECORDED_PAGE,
|
||||
|
||||
Reference in New Issue
Block a user