Merge pull request #5695 from robintown/invite-command-reason

Support sending invite reasons with /invite command
This commit is contained in:
J. Ryan Stinnett 2021-03-09 11:45:25 +00:00 committed by GitHub
commit 89301ca8d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View file

@ -53,13 +53,15 @@ export default class MultiInviter {
* instance of the class.
*
* @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
*/
invite(addrs) {
invite(addrs, reason) {
if (this.addrs.length > 0) {
throw new Error("Already inviting/invited");
}
this.addrs.push(...addrs);
this.reason = reason;
for (const addr of this.addrs) {
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 {
throw new Error('Unsupported address');
}