Fixes: Calm notifications when hitting CMD+S while editing

This commit is contained in:
Tom Moor
2019-04-23 20:54:24 -07:00
parent bc918b7bf5
commit 3eb67eaecf
3 changed files with 6 additions and 1 deletions

View File

@@ -600,7 +600,7 @@ router.post('documents.create', auth(), async ctx => {
});
router.post('documents.update', auth(), async ctx => {
const { id, title, text, publish, autosave, lastRevision } = ctx.body;
const { id, title, text, publish, autosave, done, lastRevision } = ctx.body;
ctx.assertPresent(id, 'id is required');
ctx.assertPresent(title || text, 'title or text is required');
@@ -638,6 +638,7 @@ router.post('documents.update', auth(), async ctx => {
teamId: document.teamId,
actorId: user.id,
autosave,
done,
});
}

View File

@@ -45,6 +45,7 @@ type DocumentEvent =
teamId: string,
actorId: string,
autosave: boolean,
done: boolean,
};
type CollectionEvent =

View File

@@ -20,6 +20,9 @@ export default class Notifications {
// lets not send a notification on every autosave update
if (event.autosave) return;
// wait until the user has finished editing
if (!event.done) return;
const document = await Document.findById(event.modelId);
if (!document) return;