You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-24 06:02:08 +03:00
clean up onPaste error handling in AddressPickerDialog
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@ -457,6 +457,7 @@ module.exports = React.createClass({
|
|||||||
_addAddressesToList: function(addressTexts) {
|
_addAddressesToList: function(addressTexts) {
|
||||||
const selectedList = this.state.selectedList.slice();
|
const selectedList = this.state.selectedList.slice();
|
||||||
|
|
||||||
|
let hasError = false;
|
||||||
addressTexts.forEach((addressText) => {
|
addressTexts.forEach((addressText) => {
|
||||||
addressText = addressText.trim();
|
addressText = addressText.trim();
|
||||||
const addrType = getAddressType(addressText);
|
const addrType = getAddressType(addressText);
|
||||||
@ -467,8 +468,7 @@ module.exports = React.createClass({
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!this.props.validAddressTypes.includes(addrType)) {
|
if (!this.props.validAddressTypes.includes(addrType)) {
|
||||||
this.setState({ error: true });
|
hasError = true;
|
||||||
return null;
|
|
||||||
} else if (addrType === 'mx-user-id') {
|
} else if (addrType === 'mx-user-id') {
|
||||||
const user = MatrixClientPeg.get().getUser(addrObj.address);
|
const user = MatrixClientPeg.get().getUser(addrObj.address);
|
||||||
if (user) {
|
if (user) {
|
||||||
@ -492,9 +492,10 @@ module.exports = React.createClass({
|
|||||||
selectedList,
|
selectedList,
|
||||||
suggestedList: [],
|
suggestedList: [],
|
||||||
query: "",
|
query: "",
|
||||||
|
error: hasError ? true : this.state.error,
|
||||||
});
|
});
|
||||||
if (this._cancelThreepidLookup) this._cancelThreepidLookup();
|
if (this._cancelThreepidLookup) this._cancelThreepidLookup();
|
||||||
return selectedList;
|
return hasError ? null : selectedList;
|
||||||
},
|
},
|
||||||
|
|
||||||
_lookupThreepid: function(medium, address) {
|
_lookupThreepid: function(medium, address) {
|
||||||
|
Reference in New Issue
Block a user