Refined members import modal

no refs.
- fixed title logic
- fixed stripe validation message
This commit is contained in:
Peter Zimon 2020-07-09 12:11:30 +02:00
parent cf2f12e046
commit c611f65f53
3 changed files with 12 additions and 11 deletions

View File

@ -2,12 +2,12 @@
<h1>
{{#if this.summary}}
Import complete{{unless this.importResponse.invalid.count "!"}}
{{/if}}
{{#if this.uploading}}
Importing members
{{else}}
Import members
{{#if this.uploading}}
Importing members
{{else}}
Import members
{{/if}}
{{/if}}
</h1>
</header>
@ -110,7 +110,7 @@
{{#if this.config.enableDeveloperExperiments}}
<ul class="ma0 pa0 mt4 list bt b--whitegrey">
{{#each this.importResponse.invalid.errors as |error|}}
<li class="gh-members-import-errormessage">{{error.message}} <span class="fw6">({{format-number error.count}})</span></li>
<li class="gh-members-import-errormessage">{{error.message}} <span class="fw4">({{format-number error.count}})</span></li>
{{/each}}
</ul>
{{/if}}

View File

@ -3,6 +3,7 @@ import Service, {inject as service} from '@ember/service';
import validator from 'validator';
import {formatNumber} from 'ghost-admin/helpers/format-number';
import {isEmpty} from '@ember/utils';
import {pluralize} from 'ember-inflector';
export default Service.extend({
ajax: service(),
@ -32,8 +33,8 @@ export default Service.extend({
if (!this.membersUtils.isStripeEnabled) {
validationErrors.push(new MemberImportError({
message: `Missing Stripe connection (${formatNumber(totalCount)})`,
context: `Stripe customers won't be imported. You need to <a href="#/settings/labs">connect to Stripe</a> to import stripe customers.`,
message: `Missing Stripe connection`,
context: `${formatNumber(totalCount)} ${pluralize(totalCount, 'Stripe customer', {withoutCount: true})} won't be imported. You need to <a href="#/settings/labs">connect to Stripe</a> to import Stripe customers.`,
type: 'warning'
}));
} else {
@ -49,7 +50,7 @@ export default Service.extend({
if (duplicateCount) {
validationErrors.push(new MemberImportError({
message: `Duplicate Stripe ID (${formatNumber(duplicateCount)})`,
message: `Duplicate Stripe ID <span class="fw4">(${formatNumber(duplicateCount)})</span>`,
type: 'warning'
}));
}
@ -65,7 +66,7 @@ export default Service.extend({
if (emptyCount) {
validationErrors.push(new MemberImportError({
message: `Missing email address (${formatNumber(emptyCount)})`,
message: `Missing email address <span class="fw4">(${formatNumber(emptyCount)})</span>`,
type: 'warning'
}));
}

View File

@ -57,7 +57,7 @@ describe('Integration: Service: member-import-validator', function () {
}]);
expect(validationErrors.length).to.equal(1);
expect(validationErrors[0].message).to.equal('Missing Stripe connection (1)');
expect(validationErrors[0].message).to.equal('Missing Stripe connection');
expect(mapping.email).to.equal('email');
expect(mapping.stripe_customer_id).to.equal('stripe_customer_id');
});