Share e2ee keys when using /invite SlashCommand (#7655)
This commit is contained in:
parent
15276ea3b4
commit
cbc671b19f
6 changed files with 53 additions and 35 deletions
|
@ -43,16 +43,19 @@ export interface IInviteResult {
|
|||
*
|
||||
* @param {string} roomId The ID of the room to invite to
|
||||
* @param {string[]} addresses Array of strings of addresses to invite. May be matrix IDs or 3pids.
|
||||
* @param {boolean} sendSharedHistoryKeys whether to share e2ee keys with the invitees if applicable.
|
||||
* @param {function} progressCallback optional callback, fired after each invite.
|
||||
* @returns {Promise} Promise
|
||||
*/
|
||||
export function inviteMultipleToRoom(
|
||||
roomId: string,
|
||||
addresses: string[],
|
||||
sendSharedHistoryKeys = false,
|
||||
progressCallback?: () => void,
|
||||
): Promise<IInviteResult> {
|
||||
const inviter = new MultiInviter(roomId, progressCallback);
|
||||
return inviter.invite(addresses).then(states => Promise.resolve({ states, inviter }));
|
||||
return inviter.invite(addresses, undefined, sendSharedHistoryKeys)
|
||||
.then(states => Promise.resolve({ states, inviter }));
|
||||
}
|
||||
|
||||
export function showStartChatInviteDialog(initialText = ""): void {
|
||||
|
@ -110,8 +113,13 @@ export function isValid3pidInvite(event: MatrixEvent): boolean {
|
|||
return true;
|
||||
}
|
||||
|
||||
export function inviteUsersToRoom(roomId: string, userIds: string[], progressCallback?: () => void): Promise<void> {
|
||||
return inviteMultipleToRoom(roomId, userIds, progressCallback).then((result) => {
|
||||
export function inviteUsersToRoom(
|
||||
roomId: string,
|
||||
userIds: string[],
|
||||
sendSharedHistoryKeys = false,
|
||||
progressCallback?: () => void,
|
||||
): Promise<void> {
|
||||
return inviteMultipleToRoom(roomId, userIds, sendSharedHistoryKeys, progressCallback).then((result) => {
|
||||
const room = MatrixClientPeg.get().getRoom(roomId);
|
||||
showAnyInviteErrors(result.states, room, result.inviter);
|
||||
}).catch((err) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue