element-hq / element-hq/element-call
Element Call doesn't handle a missing join_rule value in a room summary
- Dominant language
- TypeScript
- Stars
- 996
- Forks
- 213
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 54
Description
### Steps to reproduce
1. Running element call in standalone mode hooked up to Continuwuity
2. Start a new room as an anonymous user
3. Copy the invite link and open in a new browser
### Outcome
#### What did you expect?
Joining the room works successfully
#### What happened instead?
An error occurs:
and the logs show
This is due to a conditional in element call that is supposed to assume the room's `join_rule === public` if it's not present, however the check is implemented incorrectly in certain cases:
In this room summary response, the `join_rule` is not present. According to the [spec for room summaries](https://spec.matrix.org/v1.19/client-server-api/#room-summaries), `join_rule` missing should be interpreted as `public`.
When Ruma (and by extension, Continuwuity) renders the json response for a room summary, [it excludes the value](https://github.com/ruma/ruma/blob/cc10729cb63c9c965e3a45a964ef85cedfac3c5b/crates/ruma-common/src/room.rs#L394) if it's `public` - which complies with the spec.
In order to fix this, I can simply:
```patch
diff --git a/src/room/useLoadGroupCall.ts b/src/room/useLoadGroupCall.ts
index 2cd0d40b..8a7617d8 100644
--- a/src/room/useLoadGroupCall.ts
+++ b/src/room/useLoadGroupCall.ts
@@ -280,7 +280,7 @@ export const useLoadGroupCall = (
);
}
if (
- roomSummary === undefined ||
+ roomSummary?.join_rule === undefined ||
roomSummary.join_rule === JoinRule.Public
) {
room = await client.joinRoom(roomId, {
```
which ensures that if _either_ roomSummary is `undefined` (meaning the server doesn't support room summaries) _or_ `join_rule` is not supplied in the returned room summary (which means it's public), it tries to join as if it's public.
Tested on a local build of element-call, this works well and results in being able to join the room without issue, as EC now falls back to assuming the room is Public and tries to join using that method.
I have a PR that I can happily submit if this is an acceptable approach.
### Operating system
All
### Browser information
Firefox 153.0.1
### URL for webapp
Version 0.23.0
### Will you send logs?
Yes
Contributor guide
Assessment
This issue has not been assessed yet.