From b81f7ae8b9eb876ab66129cafd640a4e47dbb1c5 Mon Sep 17 00:00:00 2001 From: albemarle <45690905+albemarle@users.noreply.github.com> Date: Wed, 22 May 2019 11:05:44 -0400 Subject: [PATCH] fix(delete my account): must check if any TPA providers are connected (#60) --- package-lock.json | 5 +++++ package.json | 1 + src/account-settings/AccountSettingsPage.jsx | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 56993bf..406d547 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12306,6 +12306,11 @@ "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", "integrity": "sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=" }, + "lodash.findindex": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.findindex/-/lodash.findindex-4.6.0.tgz", + "integrity": "sha1-oyRd7mH7m24GJLU1ElYku2nBEQY=" + }, "lodash.flattendeep": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", diff --git a/package.json b/package.json index 2968a7e..2102e36 100755 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "i18n-iso-countries": "^3.7.8", "iso-countries-languages": "^0.2.1", "lodash.camelcase": "^4.3.0", + "lodash.findindex": "^4.6.0", "lodash.get": "^4.4.2", "lodash.isempty": "^4.4.0", "lodash.omit": "^4.5.0", diff --git a/src/account-settings/AccountSettingsPage.jsx b/src/account-settings/AccountSettingsPage.jsx index 4b934a9..5f0b78b 100644 --- a/src/account-settings/AccountSettingsPage.jsx +++ b/src/account-settings/AccountSettingsPage.jsx @@ -2,6 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import memoize from 'memoize-one'; +import findIndex from 'lodash.findindex'; import { injectIntl, intlShape, @@ -153,7 +154,7 @@ class AccountSettingsPage extends React.Component { this.props.countryTimeZoneOptions, ); - const hasLinkedTPA = this.props.tpaProviders && this.props.tpaProviders.length > 0; + const hasLinkedTPA = findIndex(this.props.tpaProviders, provider => provider.connected) >= 0; return (