Pull out multi-inviting from MultiInviteDialog

MultiInviteDialog would otherwise use this, but is about to go away, so it has been left.
This commit is contained in:
David Baker 2016-09-13 14:47:56 +01:00
parent 0f720dd6b8
commit 2fd9e2a98f
2 changed files with 159 additions and 0 deletions

View file

@ -15,6 +15,7 @@ limitations under the License.
*/
import MatrixClientPeg from './MatrixClientPeg';
import MultiInviter from '../../../utils/MultiInviter';
const emailRegex = /^\S+@\S+\.\S+$/;
@ -43,3 +44,17 @@ export function inviteToRoom(roomId, addr) {
throw new Error('Unsupported address');
}
}
/**
* Invites multiple addresses to a room
* Simpler interface to utils/MultiInviter but with
* no option to cancel.
*
* @param {roomId} The ID of the room to invite to
* @param {array} Array of strings of addresses to invite. May be matrix IDs or 3pids.
* @returns Promise
*/
export function inviteMultipleToRoom(roomId, addrs) {
this.inviter = new MultiInviter(roomId);
return inviter.invite(addrs);
}