Fix: Don't send notifications for autosave events
This commit is contained in:
@ -615,6 +615,7 @@ router.post('documents.update', auth(), async ctx => {
|
||||
collectionId: document.collectionId,
|
||||
teamId: document.teamId,
|
||||
actorId: user.id,
|
||||
autosave,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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 =
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user