fix: Document published notification potentially sent to users without permission to view document

This commit is contained in:
Tom Moor
2020-11-05 19:49:05 -08:00
parent fdaa36c9fd
commit 0125a5361d
2 changed files with 85 additions and 1 deletions

View File

@ -70,6 +70,13 @@ export default class Notifications {
return;
}
// Check the user has access to the collection this document is in. Just
// because they were a collaborator once doesn't mean they still are.
const collectionIds = await setting.user.collectionIds();
if (!collectionIds.includes(document.collectionId)) {
return;
}
// If this user has viewed the document since the last update was made
// then we can avoid sending them a useless notification, yay.
const view = await View.findOne({