diff --git a/core/server/api/canary/members.js b/core/server/api/canary/members.js index a8efc1d453..b1dfd696cd 100644 --- a/core/server/api/canary/members.js +++ b/core/server/api/canary/members.js @@ -225,7 +225,10 @@ const members = { return decorateWithSubscriptions(member); } catch (error) { 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 @@ -482,7 +485,7 @@ const members = { }).then(() => { // NOTE: grouping by context because messages can contain unique data like "customer_id" const groupedErrors = _.groupBy(invalid.errors, 'context'); - const uniqueErrors = _.uniq(invalid.errors, 'context'); + const uniqueErrors = _.uniqBy(invalid.errors, 'context'); const outputErrors = uniqueErrors.map((error) => { let errorGroup = groupedErrors[error.context]; diff --git a/core/server/translations/en.json b/core/server/translations/en.json index a34e45559e..09a5528255 100644 --- a/core/server/translations/en.json +++ b/core/server/translations/en.json @@ -368,7 +368,10 @@ }, "members": { "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": { "message": "Member not imported, Stripe account missing", "context": "Attempting to import members with Stripe data when there is no Stripe account connected",