mirror of https://github.com/vector-im/riot-web
Merge pull request #771 from matrix-org/dbkr/invite_always_show_valid_mxid
Fix bug where you can't invite a valid addresspull/21833/head
commit
c743663f7d
|
@ -30,15 +30,6 @@ import Fuse from 'fuse.js';
|
||||||
|
|
||||||
const TRUNCATE_QUERY_LIST = 40;
|
const TRUNCATE_QUERY_LIST = 40;
|
||||||
|
|
||||||
/*
|
|
||||||
* Escapes a string so it can be used in a RegExp
|
|
||||||
* Basically just replaces: \ ^ $ * + ? . ( ) | { } [ ]
|
|
||||||
* From http://stackoverflow.com/a/6969486
|
|
||||||
*/
|
|
||||||
function escapeRegExp(str) {
|
|
||||||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
displayName: "ChatInviteDialog",
|
displayName: "ChatInviteDialog",
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
@ -220,23 +211,22 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// If the query isn't a user we know about, but is a
|
// If the query is a valid address, add an entry for that
|
||||||
// valid address, add an entry for that
|
// This is important, otherwise there's no way to invite
|
||||||
if (queryList.length == 0) {
|
// a perfectly valid address if there are close matches.
|
||||||
const addrType = getAddressType(query);
|
const addrType = getAddressType(query);
|
||||||
if (addrType !== null) {
|
if (addrType !== null) {
|
||||||
queryList[0] = {
|
queryList.unshift({
|
||||||
addressType: addrType,
|
addressType: addrType,
|
||||||
address: query,
|
address: query,
|
||||||
isKnown: false,
|
isKnown: false,
|
||||||
};
|
});
|
||||||
if (this._cancelThreepidLookup) this._cancelThreepidLookup();
|
if (this._cancelThreepidLookup) this._cancelThreepidLookup();
|
||||||
if (addrType == 'email') {
|
if (addrType == 'email') {
|
||||||
this._lookupThreepid(addrType, query).done();
|
this._lookupThreepid(addrType, query).done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
this.setState({
|
this.setState({
|
||||||
queryList: queryList,
|
queryList: queryList,
|
||||||
error: false,
|
error: false,
|
||||||
|
|
Loading…
Reference in New Issue