diff --git a/CHANGELOG.md b/CHANGELOG.md index ffb4896db..3ac448f70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Fixed +- Don't send emails or push notifications for Announcements when notifications are turned off in a group - Bug that prevented saving group settings sometimes ## [5.0.2] - 2022-11-13 diff --git a/api/models/Activity.js b/api/models/Activity.js index 7f0cef64c..73f144c00 100644 --- a/api/models/Activity.js +++ b/api/models/Activity.js @@ -280,11 +280,13 @@ module.exports = bookshelf.Model.extend({ const emailable = membershipsPermitting('sendEmail') const pushable = membershipsPermitting('sendPushNotifications') - if ((!isEmpty(emailable) && !isJustNewPost(activity)) || isAnnouncement(activity)) { + // Send emails if email notifications on and is announcement or "not just a new post" notification + if (!isEmpty(emailable) && (!isJustNewPost(activity) || isAnnouncement(activity))) { notifications.push(Notification.MEDIUM.Email) } - if (isTopic(activity) || !isEmpty(pushable) || isAnnouncement(activity)) { + // XXX: right now all notification types get sent as a push notification. Is this what we want? + if (!isEmpty(pushable)) { notifications.push(Notification.MEDIUM.Push) }