From 03098589172a49f413e390e823fd04a1e9f68d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Oliv=C3=A9?= Date: Mon, 17 Jul 2023 12:11:38 +0200 Subject: [PATCH] =?UTF-8?q?[MMI]=C2=A0Fixed=20remove=20custodian=20token?= =?UTF-8?q?=20(#20021)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scripts/controllers/mmi-controller.js | 21 +-- .../__snapshots__/checkbox.test.tsx.snap | 2 +- .../confirm-remove-jwt-modal.test.js.snap | 154 +----------------- .../confirm-remove-jwt-modal.js | 113 ++++++++----- .../confirm-remove-jwt-modal.stories.js | 2 +- .../confirm-remove-jwt-modal.test.js | 11 +- .../confirm-remove-jwt-modal/index.scss | 1 + ...eractive-replacement-token-notification.js | 2 +- .../account-list-item-menu.js | 4 +- ui/pages/institutional/custody/custody.js | 6 +- 10 files changed, 86 insertions(+), 230 deletions(-) diff --git a/app/scripts/controllers/mmi-controller.js b/app/scripts/controllers/mmi-controller.js index 8923487b5..0ed4deaae 100644 --- a/app/scripts/controllers/mmi-controller.js +++ b/app/scripts/controllers/mmi-controller.js @@ -442,25 +442,8 @@ export default class MMIController extends EventEmitter { return keyring.getTransactionDeepLink(from, custodyTxId); } - async getCustodianToken(custodianType) { - let currentCustodyType; - - const address = this.preferencesController.getSelectedAddress(); - - if (!custodianType) { - const resultCustody = this.custodyController.getCustodyTypeByAddress( - toChecksumHexAddress(address), - ); - currentCustodyType = resultCustody; - } - let keyring = await this.keyringController.getKeyringsByType( - currentCustodyType || `Custody - ${custodianType}`, - )[0]; - if (!keyring) { - keyring = await this.keyringController.addNewKeyring( - currentCustodyType || `Custody - ${custodianType}`, - ); - } + async getCustodianToken(address) { + const keyring = await this.keyringController.getKeyringForAccount(address); const { authDetails } = keyring.getAccountDetails(address); return keyring ? authDetails.jwt || authDetails.refreshToken : ''; } diff --git a/ui/components/component-library/checkbox/__snapshots__/checkbox.test.tsx.snap b/ui/components/component-library/checkbox/__snapshots__/checkbox.test.tsx.snap index 5df6da8de..90c0f27f5 100644 --- a/ui/components/component-library/checkbox/__snapshots__/checkbox.test.tsx.snap +++ b/ui/components/component-library/checkbox/__snapshots__/checkbox.test.tsx.snap @@ -3,7 +3,7 @@ exports[`Checkbox should render the Checkbox without crashing 1`] = `