From fa660c8211bf834781af5872bae59d2b3387f99d Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 15 Aug 2017 10:57:24 +0100 Subject: [PATCH] PR feedback --- src/Invite.js | 6 +++--- src/components/views/dialogs/UserPickerDialog.js | 15 ++++++--------- src/components/views/elements/AddressSelector.js | 4 ++-- src/components/views/elements/AddressTile.js | 4 ++-- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/Invite.js b/src/Invite.js index e7e7264d11..b79a245549 100644 --- a/src/Invite.js +++ b/src/Invite.js @@ -18,9 +18,9 @@ limitations under the License. import PropTypes from 'prop-types'; import MatrixClientPeg from './MatrixClientPeg'; import MultiInviter from './utils/MultiInviter'; -import Modal from "./Modal"; +import Modal from './Modal'; import createRoom from './createRoom'; -import sdk from "./"; +import sdk from './'; import { _t } from './languageHandler'; const emailRegex = /^\S+@\S+\.\S+$/; @@ -36,7 +36,7 @@ export const addressTypes = [ // could be a third party identifier or a matrix ID) // along with some additional information about the // address / target. -export const InviteAddressType = PropTypes.shape({ +export const UserAddressType = PropTypes.shape({ addressType: PropTypes.oneOf(addressTypes).isRequired, address: PropTypes.string.isRequired, displayName: PropTypes.string, diff --git a/src/components/views/dialogs/UserPickerDialog.js b/src/components/views/dialogs/UserPickerDialog.js index 7dc1be7d25..1405bc754b 100644 --- a/src/components/views/dialogs/UserPickerDialog.js +++ b/src/components/views/dialogs/UserPickerDialog.js @@ -33,10 +33,7 @@ module.exports = React.createClass({ propTypes: { title: PropTypes.string.isRequired, - description: PropTypes.oneOfType([ - PropTypes.element, - PropTypes.string, - ]), + description: PropTypes.node, value: PropTypes.string, placeholder: PropTypes.string, roomId: PropTypes.string, @@ -58,7 +55,7 @@ module.exports = React.createClass({ return { error: false, - // List of InviteAddressType objects representing + // List of UserAddressType objects representing // the list of addresses we're going to invite inviteList: [], @@ -70,7 +67,7 @@ module.exports = React.createClass({ serverSupportsUserDirectory: true, // The query being searched for query: "", - // List of AddressTile.InviteAddressType objects representing + // List of UserAddressType objects representing // the set of auto-completion results for the current search // query. queryList: [], @@ -254,7 +251,7 @@ module.exports = React.createClass({ return; } // Return objects, structure of which is defined - // by InviteAddressType + // by UserAddressType queryList.push({ addressType: 'mx', address: user.user_id, @@ -268,7 +265,7 @@ module.exports = React.createClass({ // This is important, otherwise there's no way to invite // a perfectly valid address if there are close matches. const addrType = getAddressType(query); - if (this.props.validAddressTypes.indexOf(addrType) !== -1) { + if (this.props.validAddressTypes.includes(addrType)) { queryList.unshift({ addressType: addrType, address: query, @@ -342,7 +339,7 @@ module.exports = React.createClass({ if (cancelled) return null; this.setState({ queryList: [{ - // an InviteAddressType + // a UserAddressType addressType: medium, address: address, displayName: res.displayname, diff --git a/src/components/views/elements/AddressSelector.js b/src/components/views/elements/AddressSelector.js index 003fd534bb..1aae10737e 100644 --- a/src/components/views/elements/AddressSelector.js +++ b/src/components/views/elements/AddressSelector.js @@ -20,7 +20,7 @@ limitations under the License. import React from 'react'; import sdk from '../../../index'; import classNames from 'classnames'; -import { InviteAddressType } from '../../../Invite'; +import { UserAddressType } from '../../../Invite'; export default React.createClass({ displayName: 'AddressSelector', @@ -29,7 +29,7 @@ export default React.createClass({ onSelected: React.PropTypes.func.isRequired, // List of the addresses to display - addressList: React.PropTypes.arrayOf(InviteAddressType).isRequired, + addressList: React.PropTypes.arrayOf(UserAddressType).isRequired, truncateAt: React.PropTypes.number.isRequired, selected: React.PropTypes.number, diff --git a/src/components/views/elements/AddressTile.js b/src/components/views/elements/AddressTile.js index fb35dafa5c..ba7d79d987 100644 --- a/src/components/views/elements/AddressTile.js +++ b/src/components/views/elements/AddressTile.js @@ -20,14 +20,14 @@ import classNames from 'classnames'; import sdk from "../../../index"; import MatrixClientPeg from "../../../MatrixClientPeg"; import { _t } from '../../../languageHandler'; -import { InviteAddressType } from '../../../Invite.js'; +import { UserAddressType } from '../../../Invite.js'; export default React.createClass({ displayName: 'AddressTile', propTypes: { - address: InviteAddressType.isRequired, + address: UserAddressType.isRequired, canDismiss: React.PropTypes.bool, onDismissed: React.PropTypes.func, justified: React.PropTypes.bool,