From 2dfff367b92d184ee575e47dc2b2bde8e7176f82 Mon Sep 17 00:00:00 2001 From: Peter Zimon Date: Thu, 18 Jun 2020 10:30:15 +0200 Subject: [PATCH] Refined pre-validation of members import no issues. - removes email and Stripe duplicate customer ID check to focus validation that might affect the whole dataset - applies visual style and refines copy --- .../admin/app/components/modal-import-members.hbs | 10 +++------- .../admin/app/services/member-import-validator.js | 14 ++------------ ghost/admin/app/styles/layouts/members.css | 6 ++++++ 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/ghost/admin/app/components/modal-import-members.hbs b/ghost/admin/app/components/modal-import-members.hbs index fc194620e3..08f3d34bb6 100644 --- a/ghost/admin/app/components/modal-import-members.hbs +++ b/ghost/admin/app/components/modal-import-members.hbs @@ -42,13 +42,9 @@
{{svg-jar "warning" class="nudge-top--2 w5 h5 fill-yellow-d1"}}
-

Warning! There are some problems with the CSV data. You can still import it but data loss might occur.

- - {{#liquid-if this.errorDetailsOpen}} - {{#each validationErrors as |error|}} -

{{error.message}}

- {{/each}} - {{/liquid-if}} + {{#each validationErrors as |error|}} +

{{{error.message}}}

+ {{/each}}
{{/if}} diff --git a/ghost/admin/app/services/member-import-validator.js b/ghost/admin/app/services/member-import-validator.js index dd70fe4040..7e552fbd20 100644 --- a/ghost/admin/app/services/member-import-validator.js +++ b/ghost/admin/app/services/member-import-validator.js @@ -37,28 +37,18 @@ export default Service.extend({ } // check can be done on whole set as it won't be too slow - let emailValidation = this._checkEmails(data); - if (emailValidation !== true) { - validationResults.push(new MemberImportError('Emails in provided data don\'t appear to be valid email addresses.')); - } - const hasStripeId = this._containsRecordsWithStripeId(validatedSet); if (hasStripeId) { // check can be done on whole set as it won't be too slow if (!this.membersUtils.isStripeEnabled) { - validationResults.push(new MemberImportError(`You need to connect to Stripe first to import Stripe data.`)); + validationResults.push(new MemberImportError(`You need to connect to Stripe to import Stripe customers.`)); } else { let stripeSeverValidation = await this._checkStripeServer(validatedSet); if (stripeSeverValidation !== true) { - validationResults.push(new MemberImportError('Stripe customer IDs exist in the data, but we could not find such customer in connected Stripe account')); + validationResults.push(new MemberImportError(`The CSV contains Stripe customers from a different Stripe account. Make sure you're connected to the correct Stripe account.`)); } } - - let hasDuplicateStripeIds = this._hasDuplicateStripeIds(data); - if (hasDuplicateStripeIds === true) { - validationResults.push(new MemberImportError('Members with same Stripe customer IDs will not be imported.')); - } } if (validationResults.length) { diff --git a/ghost/admin/app/styles/layouts/members.css b/ghost/admin/app/styles/layouts/members.css index a8ead74196..7150ac0812 100644 --- a/ghost/admin/app/styles/layouts/members.css +++ b/ghost/admin/app/styles/layouts/members.css @@ -423,12 +423,18 @@ textarea.gh-member-details-textarea { border-radius: 4px; padding: 8px; margin-bottom: 20px; + color: var(--middarkgrey); } .gh-members-upload-warningmessage { border-left: 4px solid var(--yellow); } +.gh-members-upload-warningmessage p a { + color: color-mod(var(--yellow) l(-12%)); + text-decoration: underline; +} + .gh-members-upload-errormessage { border-left: 4px solid var(--red); }