From 785eb5fa15535d594eef4a56b3aadd0fce753670 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Fri, 10 Dec 2021 14:26:38 +0000 Subject: [PATCH] No-op action:join if the user is already invited for scalar (#7334) * No-op action:join if the user is already invited for scalar * Improve words --- src/ScalarMessaging.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ScalarMessaging.ts b/src/ScalarMessaging.ts index e887bf02c3e..486ef5b2996 100644 --- a/src/ScalarMessaging.ts +++ b/src/ScalarMessaging.ts @@ -53,7 +53,7 @@ All actions can return an error response instead of the response outlined below. invite ------ -Invites a user into a room. +Invites a user into a room. The request will no-op if the user is already joined OR invited to the room. Request: - room_id is the room to invite the user into. @@ -295,9 +295,9 @@ function inviteUser(event: MessageEvent, roomId: string, userId: string): v } const room = client.getRoom(roomId); if (room) { - // if they are already invited we can resolve immediately. + // if they are already invited or joined we can resolve immediately. const member = room.getMember(userId); - if (member && member.membership === "invite") { + if (member && ["join", "invite"].includes(member.membership)) { sendResponse(event, { success: true, });