Display lookup errors in the UI
This commit is contained in:
parent
55780f3caf
commit
5bb68b4b3b
1 changed files with 8 additions and 6 deletions
|
@ -74,12 +74,11 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
error: false,
|
// Whether to show an error message because of an invalid address
|
||||||
|
invalidAddressError: false,
|
||||||
// List of UserAddressType 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
|
||||||
selectedList: [],
|
selectedList: [],
|
||||||
|
|
||||||
// Whether a search is ongoing
|
// Whether a search is ongoing
|
||||||
busy: false,
|
busy: false,
|
||||||
// An error message generated during the user directory search
|
// An error message generated during the user directory search
|
||||||
|
@ -451,7 +450,7 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
suggestedList,
|
suggestedList,
|
||||||
error: false,
|
invalidAddressError: false,
|
||||||
}, () => {
|
}, () => {
|
||||||
if (this.addressSelector) this.addressSelector.moveSelectionTop();
|
if (this.addressSelector) this.addressSelector.moveSelectionTop();
|
||||||
});
|
});
|
||||||
|
@ -495,7 +494,7 @@ module.exports = React.createClass({
|
||||||
selectedList,
|
selectedList,
|
||||||
suggestedList: [],
|
suggestedList: [],
|
||||||
query: "",
|
query: "",
|
||||||
error: hasError ? true : this.state.error,
|
invalidAddressError: hasError ? true : this.state.invalidAddressError,
|
||||||
});
|
});
|
||||||
if (this._cancelThreepidLookup) this._cancelThreepidLookup();
|
if (this._cancelThreepidLookup) this._cancelThreepidLookup();
|
||||||
return hasError ? null : selectedList;
|
return hasError ? null : selectedList;
|
||||||
|
@ -543,6 +542,9 @@ module.exports = React.createClass({
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
this.setState({
|
||||||
|
searchError: _t('Something went wrong!'),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -610,7 +612,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
let error;
|
let error;
|
||||||
let addressSelector;
|
let addressSelector;
|
||||||
if (this.state.error) {
|
if (this.state.invalidAddressError) {
|
||||||
const validTypeDescriptions = this.props.validAddressTypes.map((t) => _t(addressTypeName[t]));
|
const validTypeDescriptions = this.props.validAddressTypes.map((t) => _t(addressTypeName[t]));
|
||||||
error = <div className="mx_AddressPickerDialog_error">
|
error = <div className="mx_AddressPickerDialog_error">
|
||||||
{ _t("You have entered an invalid address.") }
|
{ _t("You have entered an invalid address.") }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue