mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Fixed grouping error in members CSV importer
no issue - Import error grouping wasn't working correctly when error didn't have defined context property - The copy will be refined in final design review
This commit is contained in:
parent
51d506469d
commit
097ff9fba9
2 changed files with 9 additions and 3 deletions
|
@ -225,7 +225,10 @@ const members = {
|
||||||
return decorateWithSubscriptions(member);
|
return decorateWithSubscriptions(member);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code && error.message.toLowerCase().indexOf('unique') !== -1) {
|
if (error.code && error.message.toLowerCase().indexOf('unique') !== -1) {
|
||||||
throw new errors.ValidationError({message: i18n.t('errors.api.members.memberAlreadyExists')});
|
throw new errors.ValidationError({
|
||||||
|
message: i18n.t('errors.api.members.memberAlreadyExists.message'),
|
||||||
|
context: i18n.t('errors.api.members.memberAlreadyExists.context')
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: failed to link Stripe customer/plan/subscription
|
// NOTE: failed to link Stripe customer/plan/subscription
|
||||||
|
@ -482,7 +485,7 @@ const members = {
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
// NOTE: grouping by context because messages can contain unique data like "customer_id"
|
// NOTE: grouping by context because messages can contain unique data like "customer_id"
|
||||||
const groupedErrors = _.groupBy(invalid.errors, 'context');
|
const groupedErrors = _.groupBy(invalid.errors, 'context');
|
||||||
const uniqueErrors = _.uniq(invalid.errors, 'context');
|
const uniqueErrors = _.uniqBy(invalid.errors, 'context');
|
||||||
|
|
||||||
const outputErrors = uniqueErrors.map((error) => {
|
const outputErrors = uniqueErrors.map((error) => {
|
||||||
let errorGroup = groupedErrors[error.context];
|
let errorGroup = groupedErrors[error.context];
|
||||||
|
|
|
@ -368,7 +368,10 @@
|
||||||
},
|
},
|
||||||
"members": {
|
"members": {
|
||||||
"memberNotFound": "Member not found.",
|
"memberNotFound": "Member not found.",
|
||||||
"memberAlreadyExists": "Email address is already member.",
|
"memberAlreadyExists": {
|
||||||
|
"message": "Email address is already member.",
|
||||||
|
"context": "Attempting to add member with existing email address."
|
||||||
|
},
|
||||||
"stripeNotConnected": {
|
"stripeNotConnected": {
|
||||||
"message": "Member not imported, Stripe account missing",
|
"message": "Member not imported, Stripe account missing",
|
||||||
"context": "Attempting to import members with Stripe data when there is no Stripe account connected",
|
"context": "Attempting to import members with Stripe data when there is no Stripe account connected",
|
||||||
|
|
Loading…
Add table
Reference in a new issue