Ghost/test/unit/services
Kevin Ansfield 8d5e7ed695
🐛 Fixed unsubscribed members receiving email when a post is sent to all members (#13181)
refs https://github.com/TryGhost/Team/issues/935

The problem was incorrect operator precedence when multiple statements existed in the filter original filter when we transform it to enforce `subscribed:true` before sending.

- free only - subscribed:true+status:free - no issue
- paid only - subscribed:true+status:-free - no issue
- all - subscribed:true+status:-free,status:free - the ,status:free part is treated as a separate OR statement meaning the subscribed:true is not applied to it and free members that are unsubscribed will receive the email

- extracted the filter transform into a separate function so it can be unit tested
- updated the transform to use `()` for operator precedence, eg: `subscribed:true+(status:-free,status:free)`
- used transform function in `addEmail()` and `getEmailMemberRows()`
- fixed `sent/send` typo in error message
2021-07-26 12:47:03 +01:00
..
apps Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00
auth Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00
mail Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00
mega 🐛 Fixed unsubscribed members receiving email when a post is sent to all members (#13181) 2021-07-26 12:47:03 +01:00
members Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00
notifications Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00
permissions Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00
routing Moved labs utlity to shared 2021-07-08 09:05:41 +01:00
rss Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00
settings Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00
sitemap Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00
theme-engine Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00
themes Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00
url Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00
labs.test.js Moved labs utlity to shared 2021-07-08 09:05:41 +01:00
slack.test.js Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00
xmlrpc.test.js Renamed tests to .test.js & updated commands 2021-07-06 20:45:01 +01:00