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:
@@ -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,
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user