Support sending invite reasons with MultiInviter
Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
parent
cf0f591cba
commit
e3065f5a02
1 changed files with 4 additions and 2 deletions
|
@ -53,13 +53,15 @@ export default class MultiInviter {
|
||||||
* instance of the class.
|
* instance of the class.
|
||||||
*
|
*
|
||||||
* @param {array} addrs Array of addresses to invite
|
* @param {array} addrs Array of addresses to invite
|
||||||
|
* @param {string} reason Reason for inviting (optional)
|
||||||
* @returns {Promise} Resolved when all invitations in the queue are complete
|
* @returns {Promise} Resolved when all invitations in the queue are complete
|
||||||
*/
|
*/
|
||||||
invite(addrs) {
|
invite(addrs, reason) {
|
||||||
if (this.addrs.length > 0) {
|
if (this.addrs.length > 0) {
|
||||||
throw new Error("Already inviting/invited");
|
throw new Error("Already inviting/invited");
|
||||||
}
|
}
|
||||||
this.addrs.push(...addrs);
|
this.addrs.push(...addrs);
|
||||||
|
this.reason = reason;
|
||||||
|
|
||||||
for (const addr of this.addrs) {
|
for (const addr of this.addrs) {
|
||||||
if (getAddressType(addr) === null) {
|
if (getAddressType(addr) === null) {
|
||||||
|
@ -123,7 +125,7 @@ export default class MultiInviter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return MatrixClientPeg.get().invite(roomId, addr);
|
return MatrixClientPeg.get().invite(roomId, addr, undefined, this.reason);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Unsupported address');
|
throw new Error('Unsupported address');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue