1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-16 16:42:01 +03:00

Moved the isValidAddress method to the Invite utilty object

This commit is contained in:
wmwragg
2016-09-13 12:12:33 +01:00
parent 0b267763e2
commit cba76d651a
2 changed files with 18 additions and 18 deletions
src
Invite.js
components

@@ -43,3 +43,20 @@ export function inviteToRoom(roomId, addr) {
throw new Error('Unsupported address');
}
}
export function isValidAddress(addr) {
// Check if the addr is a valid type
var addrType = this.getAddressType(addr);
if (addrType === "mx") {
let user = MatrixClientPeg.get().getUser(addr);
if (user) {
return true;
} else {
return false;
}
} else if (addrType === "email") {
return true;
} else {
return false;
}
}