From 35c78fd71857c88d3bd3640063145c84f28951b9 Mon Sep 17 00:00:00 2001 From: Steve Larson <9larsons@gmail.com> Date: Mon, 27 Feb 2023 15:25:20 -0600 Subject: [PATCH] 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 --- ghost/members-csv/lib/unparse.js | 2 +- ghost/members-csv/test/unparse.test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ghost/members-csv/lib/unparse.js b/ghost/members-csv/lib/unparse.js index 28aad9eae3..c2f3f0149d 100644 --- a/ghost/members-csv/lib/unparse.js +++ b/ghost/members-csv/lib/unparse.js @@ -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, diff --git a/ghost/members-csv/test/unparse.test.js b/ghost/members-csv/test/unparse.test.js index 89154778c2..ea0e789745 100644 --- a/ghost/members-csv/test/unparse.test.js +++ b/ghost/members-csv/test/unparse.test.js @@ -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 = [