Skip to content

Commit

Permalink
Merge pull request #894 from Hylozoic/893-dont-send-announcements-if-…
Browse files Browse the repository at this point in the history
…notifications-off

Don't send announcement emails or push notifications when notificatio…
  • Loading branch information
tibetsprague authored Nov 23, 2022
2 parents c5f8189 + 582ed4e commit 3a38dd4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions api/models/Activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 3a38dd4

Please sign in to comment.