Skip to content
Snippets Groups Projects
Unverified Commit 6d8610ff authored by Hardik Bhatia's avatar Hardik Bhatia Committed by GitHub
Browse files

fix: Incorrect initial data not allowing edit webhooks properly (#31948)

parent 5ecfd6f0
No related branches found
No related tags found
No related merge requests found
---
'@rocket.chat/meteor': patch
---
Fixes an issue not allowing edit webhooks properly
......@@ -13,17 +13,17 @@ import { useUpdateIntegration } from '../hooks/useUpdateIntegration';
import IncomingWebhookForm from './IncomingWebhookForm';
const getInitialValue = (webhookData: Serialized<IIncomingIntegration> | undefined) => ({
enabled: webhookData?.enabled || false,
channel: webhookData?.channel.join(', ') || '',
username: webhookData?.username || '',
name: webhookData?.name || '',
alias: webhookData?.alias || '',
avatar: webhookData?.avatar || '',
emoji: webhookData?.emoji || '',
scriptEnabled: webhookData?.scriptEnabled || false,
scriptEngine: webhookData?.scriptEngine || 'isolated-vm',
overrideDestinationChannelEnabled: webhookData?.overrideDestinationChannelEnabled || false,
script: webhookData?.script || '',
enabled: webhookData?.enabled ?? true,
channel: webhookData?.channel.join(', ') ?? '',
username: webhookData?.username ?? '',
name: webhookData?.name ?? '',
alias: webhookData?.alias ?? '',
avatar: webhookData?.avatar ?? '',
emoji: webhookData?.emoji ?? '',
scriptEnabled: webhookData?.scriptEnabled ?? false,
scriptEngine: webhookData?.scriptEngine ?? 'isolated-vm',
overrideDestinationChannelEnabled: webhookData?.overrideDestinationChannelEnabled ?? false,
script: webhookData?.script ?? '',
});
const INCOMING_TYPE = 'webhook-incoming';
......
......@@ -14,27 +14,27 @@ import { useUpdateIntegration } from '../hooks/useUpdateIntegration';
import OutgoingWebhookForm from './OutgoingWebhookForm';
const getInitialValue = (webhookData: Serialized<IOutgoingIntegration> | undefined, defaultToken: string) => ({
enabled: webhookData?.enabled || true,
impersonateUser: webhookData?.impersonateUser || false,
event: webhookData?.event || 'sendMessage',
enabled: webhookData?.enabled ?? true,
impersonateUser: webhookData?.impersonateUser ?? false,
event: webhookData?.event ?? 'sendMessage',
urls: webhookData?.urls?.join('\n') ?? '',
token: webhookData?.token || defaultToken,
triggerWords: triggerWordsToString(webhookData?.triggerWords) || '',
targetRoom: webhookData?.targetRoom || '',
channel: webhookData?.channel.join(', ') || '',
username: webhookData?.username || '',
name: webhookData?.name || '',
alias: webhookData?.alias || '',
avatar: webhookData?.avatar || '',
emoji: webhookData?.emoji || '',
scriptEnabled: webhookData?.scriptEnabled || false,
scriptEngine: webhookData?.scriptEngine || 'isolated-vm',
script: webhookData?.script || '',
retryFailedCalls: webhookData?.retryFailedCalls || true,
retryCount: webhookData?.retryCount || 6,
retryDelay: webhookData?.retryDelay || 'powers-of-ten',
triggerWordAnywhere: webhookData?.triggerWordAnywhere || false,
runOnEdits: webhookData?.runOnEdits || true,
token: webhookData?.token ?? defaultToken,
triggerWords: triggerWordsToString(webhookData?.triggerWords) ?? '',
targetRoom: webhookData?.targetRoom ?? '',
channel: webhookData?.channel.join(', ') ?? '',
username: webhookData?.username ?? '',
name: webhookData?.name ?? '',
alias: webhookData?.alias ?? '',
avatar: webhookData?.avatar ?? '',
emoji: webhookData?.emoji ?? '',
scriptEnabled: webhookData?.scriptEnabled ?? false,
scriptEngine: webhookData?.scriptEngine ?? 'isolated-vm',
script: webhookData?.script ?? '',
retryFailedCalls: webhookData?.retryFailedCalls ?? true,
retryCount: webhookData?.retryCount ?? 6,
retryDelay: webhookData?.retryDelay ?? 'powers-of-ten',
triggerWordAnywhere: webhookData?.triggerWordAnywhere ?? false,
runOnEdits: webhookData?.runOnEdits ?? true,
});
const OUTGOING_TYPE = 'webhook-outgoing';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment