From b833a030e7acc7184578df960caabfec8dab32bd Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 28 Nov 2019 09:24:02 -0700 Subject: [PATCH] Invite invited members too --- src/SlashCommands.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/SlashCommands.js b/src/SlashCommands.js index a65be9e0ff..b488fa821b 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -176,12 +176,14 @@ export const CommandMap = { const {replacement_room: newRoomId} = await upgradePromise; if (newRoom.roomId !== newRoomId) return; - const joinedMembers = room.getJoinedMembers() - .map(m => m.userId).filter(m => m !== cli.getUserId()); + const toInvite = [ + ...room.getMembersWithMembership("join"), + ...room.getMembersWithMembership("invite"), + ].map(m => m.userId).filter(m => m !== cli.getUserId()); - if (joinedMembers.length > 0) { + if (toInvite.length > 0) { // Errors are handled internally to this function - await inviteUsersToRoom(newRoomId, joinedMembers); + await inviteUsersToRoom(newRoomId, toInvite); } cli.removeListener('Room', checkForUpgradeFn);