The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rocket.Chat/server/startup/migrations/v089.js

18 lines
685 B

Enhance outgoing webhooks and add history (#5823) * Convert the majority of the integrations package to JavaScript * Move the trigger handler to it's own class * Start trying to generalize integration items * Yay, additional events trigger outgoing webhooks * Silence codacy and fix eslint problems. * Started work on user created event for outgoing integrations * Finish the outgoing integration work on the user created event. * Add user join and leave room events for outgoing webhooks * Add fields to the rest api integration creation and clean up the processWebhookMessage * Add the HTTP to the incoming webhook context * Don't check for property on result if it isn't there. Closes #4175, #5762, and #5896. * Add archive room and file upload events for the webhooks * Disable integrations when the user to run/post as gets deleted. * Try to fix the tests failing due to the requird events property * Add history of integration which get fired * Add the missing file for the IntegrationHistory * Fix deleting users being broke due to my code * Add the outgoing webhook integration history viewing page along with v1 rest api to retrieve it * Integration history replays are now enabled along with advanced settings * Work on the advanced settings and enable paging on the integration history * Enable i18n for the history and advanced settings * Update the wording on the word placement * Move migration to be 88 now. * Add missing translations for the webhooks * Fix en.i18n.json identation * Fix integrations.html indentation * Fix more identations * Fix identation of integrationsOutgoing.html
9 years ago
RocketChat.Migrations.add({
version: 89,
up() {
const outgoingIntegrations = RocketChat.models.Integrations.find({ type: 'webhook-outgoing' }, { fields: { name: 1 }}).fetch();
outgoingIntegrations.forEach((i) => {
RocketChat.models.Integrations.update(i._id, { $set: { event: 'sendMessage', retryFailedCalls: true, retryCount: 6, retryDelay: 'powers-of-ten' }});
});
},
down() {
const outgoingIntegrations = RocketChat.models.Integrations.find({ type: 'webhook-outgoing', event: { $ne: 'sendMessage' }}, { fields: { name: 1 }}).fetch();
outgoingIntegrations.forEach((i) => {
RocketChat.models.Integrations.update(i._id, { $set: { enabled: false }});
});
}
});