Fixes: Calm notifications when hitting CMD+S while editing
This commit is contained in:
@@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ type DocumentEvent =
|
||||
teamId: string,
|
||||
actorId: string,
|
||||
autosave: boolean,
|
||||
done: boolean,
|
||||
};
|
||||
|
||||
type CollectionEvent =
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user