Fix: Don't send notifications for autosave events

This commit is contained in:
Tom Moor
2019-04-17 21:55:11 -07:00
parent 77f28584d4
commit 5b34a4f076
4 changed files with 15 additions and 1 deletions

View File

@ -615,6 +615,7 @@ router.post('documents.update', auth(), async ctx => {
collectionId: document.collectionId,
teamId: document.teamId,
actorId: user.id,
autosave,
});
}

View File

@ -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 =

View File

@ -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;

View File

@ -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;