fixed member import email setting import (#16269)

refs TryGhost/Team#2605
-updated unparse to look at both subscribed and subscribed_to_emails
-subscribed is for backwards compatibility
-may want to retire subscribed since we can't set from front-end
This commit is contained in:
Steve Larson 2023-02-27 15:25:20 -06:00 committed by GitHub
parent a86737875c
commit 35c78fd718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ const unparse = (members, columns = DEFAULT_COLUMNS.slice()) => {
email: member.email,
name: member.name,
note: member.note,
subscribed_to_emails: member.subscribed,
subscribed_to_emails: member.subscribed || member.subscribed_to_emails ? true : false,
complimentary_plan: member.comped || member.complimentary_plan,
stripe_customer_id: _.get(member, 'subscriptions[0].customer.id') || member.stripe_customer_id,
created_at: member.created_at,

View File

@ -13,14 +13,14 @@ describe('unparse', function () {
assert.ok(result);
const expected = `id,email,name,note,subscribed_to_emails,complimentary_plan,stripe_customer_id,created_at,deleted_at,labels,tiers\r\n,email@example.com,Sam Memberino,Early supporter,,,,,,,`;
const expected = `id,email,name,note,subscribed_to_emails,complimentary_plan,stripe_customer_id,created_at,deleted_at,labels,tiers\r\n,email@example.com,Sam Memberino,Early supporter,false,,,,,,`;
assert.equal(result, expected);
});
it('maps the subscribed property to subscribed_to_emails', function () {
const json = [{
email: 'do-not-email-me@email.com',
subscribed: false
subscribed_to_emails: false
}];
const columns = [