mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
Updated default newsletter subscriptions for member
refs https://github.com/TryGhost/Team/issues/1469 Previously, members were subscribed to all available newsletters by default when added. This change updates the default newsletters subscription for member to take into account newsletter preferences for auto opt-in as well as visibility.
This commit is contained in:
parent
415698f0f4
commit
f9ce2d9064
1 changed files with 11 additions and 5 deletions
|
@ -197,9 +197,15 @@ module.exports = class MemberRepository {
|
||||||
memberStatusData.status = 'comped';
|
memberStatusData.status = 'comped';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscribe member to all newsletters by default
|
// Subscribe member to default newsletters
|
||||||
if (!memberData.newsletters && this._labsService.isSet('multipleNewsletters')) {
|
if (!memberData.newsletters && this._labsService.isSet('multipleNewsletters')) {
|
||||||
const newsletters = await this._newslettersService.browse(_.pick(options, 'transacting'));
|
const browseOptions = _.pick(options, 'transacting');
|
||||||
|
|
||||||
|
// By default subscribe to all active auto opt-in newsletters with members visibility
|
||||||
|
//TODO: Will mostly need to be updated later for paid-only newsletters
|
||||||
|
browseOptions.filter = 'status:active+subscribe_on_signup:true+visibility:members';
|
||||||
|
const newsletters = await this._newslettersService.browse(browseOptions);
|
||||||
|
|
||||||
memberData.newsletters = newsletters || [];
|
memberData.newsletters = newsletters || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,9 +718,9 @@ module.exports = class MemberRepository {
|
||||||
plan_amount: subscriptionPriceData.unit_amount,
|
plan_amount: subscriptionPriceData.unit_amount,
|
||||||
plan_currency: subscriptionPriceData.currency,
|
plan_currency: subscriptionPriceData.currency,
|
||||||
mrr: this.getMRR({
|
mrr: this.getMRR({
|
||||||
interval: _.get(subscriptionPriceData, 'recurring.interval', ''),
|
interval: _.get(subscriptionPriceData, 'recurring.interval', ''),
|
||||||
amount: subscriptionPriceData.unit_amount,
|
amount: subscriptionPriceData.unit_amount,
|
||||||
status: subscription.status,
|
status: subscription.status,
|
||||||
canceled: subscription.cancel_at_period_end,
|
canceled: subscription.cancel_at_period_end,
|
||||||
discount: subscription.discount
|
discount: subscription.discount
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue