0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Updated options format in email alert method to prevent filter override

refs https://github.com/TryGhost/Team/issues/1826

- doesn't allow `filter` to be overridden by passed in options
This commit is contained in:
Rishabh 2022-08-25 20:14:15 +05:30
parent 6e2579ec9d
commit e6246b191e

View file

@ -505,7 +505,8 @@ User = ghostBookshelf.Model.extend({
} else if (type === 'paid-canceled') {
filter += '+paid_subscription_canceled_notification:true';
}
return this.findAll(_.merge({filter, withRelated: ['roles']}, options)).then((users) => {
const updatedOptions = _.merge({}, options, {filter, withRelated: ['roles']});
return this.findAll(updatedOptions).then((users) => {
return users.toJSON().filter((user) => {
return user?.roles?.some((role) => {
return ['Owner', 'Administrator'].includes(role.name);