diff --git a/server/api/documents.js b/server/api/documents.js index d72b439b8..4e64df31b 100644 --- a/server/api/documents.js +++ b/server/api/documents.js @@ -615,6 +615,7 @@ router.post('documents.update', auth(), async ctx => { collectionId: document.collectionId, teamId: document.teamId, actorId: user.id, + autosave, }); } diff --git a/server/events.js b/server/events.js index d5b52b6a9..d576d102f 100644 --- a/server/events.js +++ b/server/events.js @@ -17,7 +17,6 @@ type DocumentEvent = | { name: | 'documents.create' // eslint-disable-line | 'documents.publish' - | 'documents.update' | 'documents.delete' | 'documents.pin' | 'documents.unpin' @@ -38,6 +37,14 @@ type DocumentEvent = documentIds: string[], teamId: string, actorId: string, + } + | { + name: 'documents.update', + modelId: string, + collectionId: string, + teamId: string, + actorId: string, + autosave: boolean, }; type CollectionEvent = diff --git a/server/services/notifications.js b/server/services/notifications.js index 64a271c1d..f5f0dcacb 100644 --- a/server/services/notifications.js +++ b/server/services/notifications.js @@ -17,6 +17,9 @@ export default class Notifications { } async documentUpdated(event: Event) { + // lets not send a notification on every autosave update + if (event.autosave) return; + const document = await Document.findById(event.modelId); if (!document) return; diff --git a/server/services/slack.js b/server/services/slack.js index f8d16a3f9..e016b3cb1 100644 --- a/server/services/slack.js +++ b/server/services/slack.js @@ -57,6 +57,9 @@ export default class Slack { } async documentUpdated(event: Event) { + // lets not send a notification on every autosave update + if (event.autosave) return; + const document = await Document.findById(event.modelId); if (!document) return;