From 0bc9d1bc38a48716ae9ca3d84e19fba076283f92 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Fri, 10 Dec 2021 14:14:23 +0000 Subject: [PATCH 1/2] No-op action:join if the user is already invited for scalar --- src/ScalarMessaging.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ScalarMessaging.ts b/src/ScalarMessaging.ts index e887bf02c3e..5e56d644e2f 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 in 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, }); From 2baa2588195e540a330d301bc7613c9704edc781 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Fri, 10 Dec 2021 14:20:22 +0000 Subject: [PATCH 2/2] Improve words --- src/ScalarMessaging.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ScalarMessaging.ts b/src/ScalarMessaging.ts index 5e56d644e2f..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. The request will no-op if the user is already in the 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.