mirror of https://github.com/vector-im/riot-web
PR feedback
parent
b7b449434d
commit
fa660c8211
|
@ -18,9 +18,9 @@ limitations under the License.
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import MatrixClientPeg from './MatrixClientPeg';
|
import MatrixClientPeg from './MatrixClientPeg';
|
||||||
import MultiInviter from './utils/MultiInviter';
|
import MultiInviter from './utils/MultiInviter';
|
||||||
import Modal from "./Modal";
|
import Modal from './Modal';
|
||||||
import createRoom from './createRoom';
|
import createRoom from './createRoom';
|
||||||
import sdk from "./";
|
import sdk from './';
|
||||||
import { _t } from './languageHandler';
|
import { _t } from './languageHandler';
|
||||||
|
|
||||||
const emailRegex = /^\S+@\S+\.\S+$/;
|
const emailRegex = /^\S+@\S+\.\S+$/;
|
||||||
|
@ -36,7 +36,7 @@ export const addressTypes = [
|
||||||
// could be a third party identifier or a matrix ID)
|
// could be a third party identifier or a matrix ID)
|
||||||
// along with some additional information about the
|
// along with some additional information about the
|
||||||
// address / target.
|
// address / target.
|
||||||
export const InviteAddressType = PropTypes.shape({
|
export const UserAddressType = PropTypes.shape({
|
||||||
addressType: PropTypes.oneOf(addressTypes).isRequired,
|
addressType: PropTypes.oneOf(addressTypes).isRequired,
|
||||||
address: PropTypes.string.isRequired,
|
address: PropTypes.string.isRequired,
|
||||||
displayName: PropTypes.string,
|
displayName: PropTypes.string,
|
||||||
|
|
|
@ -33,10 +33,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
title: PropTypes.string.isRequired,
|
title: PropTypes.string.isRequired,
|
||||||
description: PropTypes.oneOfType([
|
description: PropTypes.node,
|
||||||
PropTypes.element,
|
|
||||||
PropTypes.string,
|
|
||||||
]),
|
|
||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
placeholder: PropTypes.string,
|
placeholder: PropTypes.string,
|
||||||
roomId: PropTypes.string,
|
roomId: PropTypes.string,
|
||||||
|
@ -58,7 +55,7 @@ module.exports = React.createClass({
|
||||||
return {
|
return {
|
||||||
error: false,
|
error: false,
|
||||||
|
|
||||||
// List of InviteAddressType objects representing
|
// List of UserAddressType objects representing
|
||||||
// the list of addresses we're going to invite
|
// the list of addresses we're going to invite
|
||||||
inviteList: [],
|
inviteList: [],
|
||||||
|
|
||||||
|
@ -70,7 +67,7 @@ module.exports = React.createClass({
|
||||||
serverSupportsUserDirectory: true,
|
serverSupportsUserDirectory: true,
|
||||||
// The query being searched for
|
// The query being searched for
|
||||||
query: "",
|
query: "",
|
||||||
// List of AddressTile.InviteAddressType objects representing
|
// List of UserAddressType objects representing
|
||||||
// the set of auto-completion results for the current search
|
// the set of auto-completion results for the current search
|
||||||
// query.
|
// query.
|
||||||
queryList: [],
|
queryList: [],
|
||||||
|
@ -254,7 +251,7 @@ module.exports = React.createClass({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Return objects, structure of which is defined
|
// Return objects, structure of which is defined
|
||||||
// by InviteAddressType
|
// by UserAddressType
|
||||||
queryList.push({
|
queryList.push({
|
||||||
addressType: 'mx',
|
addressType: 'mx',
|
||||||
address: user.user_id,
|
address: user.user_id,
|
||||||
|
@ -268,7 +265,7 @@ module.exports = React.createClass({
|
||||||
// This is important, otherwise there's no way to invite
|
// This is important, otherwise there's no way to invite
|
||||||
// a perfectly valid address if there are close matches.
|
// a perfectly valid address if there are close matches.
|
||||||
const addrType = getAddressType(query);
|
const addrType = getAddressType(query);
|
||||||
if (this.props.validAddressTypes.indexOf(addrType) !== -1) {
|
if (this.props.validAddressTypes.includes(addrType)) {
|
||||||
queryList.unshift({
|
queryList.unshift({
|
||||||
addressType: addrType,
|
addressType: addrType,
|
||||||
address: query,
|
address: query,
|
||||||
|
@ -342,7 +339,7 @@ module.exports = React.createClass({
|
||||||
if (cancelled) return null;
|
if (cancelled) return null;
|
||||||
this.setState({
|
this.setState({
|
||||||
queryList: [{
|
queryList: [{
|
||||||
// an InviteAddressType
|
// a UserAddressType
|
||||||
addressType: medium,
|
addressType: medium,
|
||||||
address: address,
|
address: address,
|
||||||
displayName: res.displayname,
|
displayName: res.displayname,
|
||||||
|
|
|
@ -20,7 +20,7 @@ limitations under the License.
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import sdk from '../../../index';
|
import sdk from '../../../index';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { InviteAddressType } from '../../../Invite';
|
import { UserAddressType } from '../../../Invite';
|
||||||
|
|
||||||
export default React.createClass({
|
export default React.createClass({
|
||||||
displayName: 'AddressSelector',
|
displayName: 'AddressSelector',
|
||||||
|
@ -29,7 +29,7 @@ export default React.createClass({
|
||||||
onSelected: React.PropTypes.func.isRequired,
|
onSelected: React.PropTypes.func.isRequired,
|
||||||
|
|
||||||
// List of the addresses to display
|
// List of the addresses to display
|
||||||
addressList: React.PropTypes.arrayOf(InviteAddressType).isRequired,
|
addressList: React.PropTypes.arrayOf(UserAddressType).isRequired,
|
||||||
truncateAt: React.PropTypes.number.isRequired,
|
truncateAt: React.PropTypes.number.isRequired,
|
||||||
selected: React.PropTypes.number,
|
selected: React.PropTypes.number,
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,14 @@ import classNames from 'classnames';
|
||||||
import sdk from "../../../index";
|
import sdk from "../../../index";
|
||||||
import MatrixClientPeg from "../../../MatrixClientPeg";
|
import MatrixClientPeg from "../../../MatrixClientPeg";
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import { InviteAddressType } from '../../../Invite.js';
|
import { UserAddressType } from '../../../Invite.js';
|
||||||
|
|
||||||
|
|
||||||
export default React.createClass({
|
export default React.createClass({
|
||||||
displayName: 'AddressTile',
|
displayName: 'AddressTile',
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
address: InviteAddressType.isRequired,
|
address: UserAddressType.isRequired,
|
||||||
canDismiss: React.PropTypes.bool,
|
canDismiss: React.PropTypes.bool,
|
||||||
onDismissed: React.PropTypes.func,
|
onDismissed: React.PropTypes.func,
|
||||||
justified: React.PropTypes.bool,
|
justified: React.PropTypes.bool,
|
||||||
|
|
Loading…
Reference in New Issue