Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
No-op action:join if the user is already invited for scalar (#7334)
Browse files Browse the repository at this point in the history
* No-op action:join if the user is already invited for scalar

* Improve words
  • Loading branch information
Half-Shot authored Dec 10, 2021
1 parent c21895b commit 785eb5f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ScalarMessaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -295,9 +295,9 @@ function inviteUser(event: MessageEvent<any>, 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,
});
Expand Down

0 comments on commit 785eb5f

Please sign in to comment.