From c60295fccaf4eeed1b4ca1b161cca54984bd796d Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 28 Aug 2019 00:22:22 -0700 Subject: [PATCH] fix: Slack notification not sent on publish, reported via Spectrum --- server/services/slack.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/server/services/slack.js b/server/services/slack.js index 427af09bb..cd4ab5310 100644 --- a/server/services/slack.js +++ b/server/services/slack.js @@ -58,15 +58,23 @@ export default class Slack { async documentUpdated(event: DocumentEvent) { // lets not send a notification on every autosave update - if (event.data && event.data.autosave) return; + if ( + event.name === 'documents.update' && + event.data && + event.data.autosave + ) { + return; + } // lets not send a notification on every CMD+S update - if (event.data && !event.data.done) return; + if (event.name === 'documents.update' && event.data && !event.data.done) { + return; + } const document = await Document.findByPk(event.documentId); if (!document) return; - // never send information on draft documents + // never send notifications for draft documents if (!document.publishedAt) return; const integration = await Integration.findOne({