fix: Suppress notifications for suspended users (#2448)

* fix: Supress notifications for suspended users

* spelling

Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
David Herman
2021-08-13 18:32:19 +02:00
committed by GitHub
parent a1a4fd1baf
commit 1521d4dbac

View File

@@ -63,6 +63,11 @@ export default class Notifications {
event.name === "documents.publish" ? "published" : "updated";
for (const setting of notificationSettings) {
// Suppress notifications for suspended users
if (setting.user.isSuspended) {
continue;
}
// For document updates we only want to send notifications if
// the document has been edited by the user with this notification setting
// This could be replaced with ability to "follow" in the future
@@ -141,14 +146,19 @@ export default class Notifications {
],
});
notificationSettings.forEach((setting) =>
notificationSettings.forEach((setting) => {
// Suppress notifications for suspended users
if (setting.user.isSuspended) {
return;
}
mailer.collectionNotification({
to: setting.user.email,
eventName: "created",
collection,
actor: collection.user,
unsubscribeUrl: setting.unsubscribeUrl,
})
);
});
});
}
}