From e3065f5a02533c38f0a7b770c519c5314d27880d Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Fri, 26 Feb 2021 17:09:54 -0500 Subject: [PATCH] Support sending invite reasons with MultiInviter Signed-off-by: Robin Townsend --- src/utils/MultiInviter.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/MultiInviter.js b/src/utils/MultiInviter.js index 7d1c900360..63d3942b37 100644 --- a/src/utils/MultiInviter.js +++ b/src/utils/MultiInviter.js @@ -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'); }