diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index ec2e1221b..09ef20260 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -1,4 +1,8 @@ { + "eth_accounts": { + "message": "View your public address (required)", + "description": "The description for the `eth_accounts` permission" + }, "connectedSites": { "message": "Connected sites" }, diff --git a/app/scripts/controllers/permissions/restrictedMethods.js b/app/scripts/controllers/permissions/restrictedMethods.js index 15f240aca..6fc6122e7 100644 --- a/app/scripts/controllers/permissions/restrictedMethods.js +++ b/app/scripts/controllers/permissions/restrictedMethods.js @@ -1,8 +1,6 @@ export default function getRestrictedMethods ({ getIdentities, getKeyringAccounts }) { return { - 'eth_accounts': { - description: `View your public address (required)`, method: (_, res, __, end) => { getKeyringAccounts() .then((accounts) => { diff --git a/ui/app/components/app/connected-accounts-list/connected-accounts-list-permissions/connected-accounts-list-permissions.component.js b/ui/app/components/app/connected-accounts-list/connected-accounts-list-permissions/connected-accounts-list-permissions.component.js index 40e8763e4..15d643238 100644 --- a/ui/app/components/app/connected-accounts-list/connected-accounts-list-permissions/connected-accounts-list-permissions.component.js +++ b/ui/app/components/app/connected-accounts-list/connected-accounts-list-permissions/connected-accounts-list-permissions.component.js @@ -14,7 +14,6 @@ export default class ConnectedAccountsListPermissions extends PureComponent { static propTypes = { permissions: PropTypes.arrayOf(PropTypes.shape({ key: PropTypes.string.isRequired, - description: PropTypes.string.isRequired, })), } @@ -56,9 +55,9 @@ export default class ConnectedAccountsListPermissions extends PureComponent { >

{t('authorizedPermissions')}:

diff --git a/ui/app/components/app/connected-accounts-list/connected-accounts-list.component.js b/ui/app/components/app/connected-accounts-list/connected-accounts-list.component.js index 62ed347f2..bcc601ef8 100644 --- a/ui/app/components/app/connected-accounts-list/connected-accounts-list.component.js +++ b/ui/app/components/app/connected-accounts-list/connected-accounts-list.component.js @@ -28,7 +28,6 @@ export default class ConnectedAccountsList extends PureComponent { })).isRequired, permissions: PropTypes.arrayOf(PropTypes.shape({ key: PropTypes.string.isRequired, - description: PropTypes.string.isRequired, })), selectedAddress: PropTypes.string.isRequired, addPermittedAccount: PropTypes.func.isRequired, diff --git a/ui/app/components/app/permission-page-container/permission-page-container-content/permission-page-container-content.component.js b/ui/app/components/app/permission-page-container/permission-page-container-content/permission-page-container-content.component.js index 4a037496a..71e94c0e1 100644 --- a/ui/app/components/app/permission-page-container/permission-page-container-content/permission-page-container-content.component.js +++ b/ui/app/components/app/permission-page-container/permission-page-container-content/permission-page-container-content.component.js @@ -10,7 +10,6 @@ export default class PermissionPageContainerContent extends PureComponent { static propTypes = { domainMetadata: PropTypes.object.isRequired, selectedPermissions: PropTypes.object.isRequired, - permissionsDescriptions: PropTypes.object.isRequired, onPermissionToggle: PropTypes.func.isRequired, selectedIdentities: PropTypes.array, allIdentitiesSelected: PropTypes.bool, @@ -64,17 +63,13 @@ export default class PermissionPageContainerContent extends PureComponent { renderRequestedPermissions () { const { - selectedPermissions, permissionsDescriptions, onPermissionToggle, + selectedPermissions, onPermissionToggle, } = this.props const { t } = this.context const items = Object.keys(selectedPermissions).map((methodName) => { - // the request will almost certainly be reject by rpc-cap if this happens - if (!permissionsDescriptions[methodName]) { - console.warn(`Unknown permission requested: ${methodName}`) - } - const description = permissionsDescriptions[methodName] || methodName + const description = t(methodName) // don't allow deselecting eth_accounts const isDisabled = methodName === 'eth_accounts' diff --git a/ui/app/components/app/permission-page-container/permission-page-container.component.js b/ui/app/components/app/permission-page-container/permission-page-container.component.js index 26b81d73d..320c28be4 100644 --- a/ui/app/components/app/permission-page-container/permission-page-container.component.js +++ b/ui/app/components/app/permission-page-container/permission-page-container.component.js @@ -12,7 +12,6 @@ export default class PermissionPageContainer extends Component { rejectPermissionsRequest: PropTypes.func.isRequired, selectedIdentities: PropTypes.array, allIdentitiesSelected: PropTypes.bool, - permissionsDescriptions: PropTypes.object.isRequired, request: PropTypes.object, redirect: PropTypes.bool, permissionRejected: PropTypes.bool, @@ -116,7 +115,6 @@ export default class PermissionPageContainer extends Component { const { requestMetadata, targetDomainMetadata, - permissionsDescriptions, selectedIdentities, redirect, permissionRejected, @@ -129,7 +127,6 @@ export default class PermissionPageContainer extends Component { requestMetadata={requestMetadata} domainMetadata={targetDomainMetadata} selectedPermissions={this.state.selectedPermissions} - permissionsDescriptions={permissionsDescriptions} onPermissionToggle={this.onPermissionToggle} selectedIdentities={selectedIdentities} redirect={redirect} diff --git a/ui/app/components/app/permission-page-container/permission-page-container.container.js b/ui/app/components/app/permission-page-container/permission-page-container.container.js index bf88eebf9..4a2229c85 100644 --- a/ui/app/components/app/permission-page-container/permission-page-container.container.js +++ b/ui/app/components/app/permission-page-container/permission-page-container.container.js @@ -1,7 +1,6 @@ import { connect } from 'react-redux' import PermissionPageContainer from './permission-page-container.component' import { - getPermissionsDescriptions, getTargetDomainMetadata, getMetaMaskIdentities, } from '../../../selectors' @@ -14,7 +13,6 @@ const mapStateToProps = (state, ownProps) => { const allIdentitiesSelected = Object.keys(selectedIdentities).length === Object.keys(allIdentities).length && selectedIdentities.length > 1 return { - permissionsDescriptions: getPermissionsDescriptions(state), targetDomainMetadata, allIdentitiesSelected, } diff --git a/ui/app/selectors/permissions.js b/ui/app/selectors/permissions.js index 377737452..7ab981833 100644 --- a/ui/app/selectors/permissions.js +++ b/ui/app/selectors/permissions.js @@ -241,14 +241,11 @@ export function getPermissionsForActiveTab (state) { const { activeTab, metamask } = state const { domains = {}, - permissionsDescriptions, } = metamask return domains[activeTab.origin]?.permissions?.map(({ parentCapability }) => { - const description = permissionsDescriptions[parentCapability] return { key: parentCapability, - description, } }) } diff --git a/ui/app/selectors/selectors.js b/ui/app/selectors/selectors.js index 516221c33..b5d10f88a 100644 --- a/ui/app/selectors/selectors.js +++ b/ui/app/selectors/selectors.js @@ -302,10 +302,6 @@ export function getCustomNonceValue (state) { return String(state.metamask.customNonceValue) } -export function getPermissionsDescriptions (state) { - return state.metamask.permissionsDescriptions -} - export function getPermissionsRequests (state) { return state.metamask.permissionsRequests || [] } diff --git a/ui/app/selectors/tests/permissions.test.js b/ui/app/selectors/tests/permissions.test.js index a984fdeb8..74347d0f9 100644 --- a/ui/app/selectors/tests/permissions.test.js +++ b/ui/app/selectors/tests/permissions.test.js @@ -428,16 +428,12 @@ describe('selectors', function () { }, }, }, - permissionsDescriptions: { - 'eth_accounts': "View the addresses of the user's chosen accounts.", - }, }, } it('should return a list of permissions strings', function () { assert.deepEqual(getPermissionsForActiveTab(mockState), [{ key: 'eth_accounts', - description: "View the addresses of the user's chosen accounts.", }]) }) })