-
Notifications
You must be signed in to change notification settings - Fork 127
[Netlify] Add sticky event support #3513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: livekit
Are you sure you want to change the base?
Changes from all commits
0edbae7
ab2af2b
bcb252f
28118b4
9ebc189
bfc198e
b3981d6
c9b8a9b
c64132e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,19 +113,41 @@ const roomIsJoinable = (room: Room): boolean => { | |
} | ||
}; | ||
|
||
/** | ||
* Determines if a given room has call events in it, and therefore | ||
* is likely to be a call room. | ||
* @param room The Matrix room instance. | ||
* @returns `true` if the room has call events. | ||
*/ | ||
const roomHasCallMembershipEvents = (room: Room): boolean => { | ||
switch (room.getMyMembership()) { | ||
case KnownMembership.Join: | ||
return !!room | ||
.getLiveTimeline() | ||
.getState(EventTimeline.FORWARDS) | ||
?.events?.get(EventType.GroupCallMemberPrefix); | ||
case KnownMembership.Knock: | ||
// Assume that a room you've knocked on is able to hold calls | ||
return true; | ||
default: | ||
return false; | ||
// Legacy events. | ||
const myMembership = room.getMyMembership(); | ||
if (myMembership === KnownMembership.Knock) { | ||
// Assume that a room you've knocked on is able to hold calls | ||
return true; | ||
} else if (myMembership !== KnownMembership.Join) { | ||
// Otherwise, non-joined rooms should never show up. | ||
return false; | ||
} | ||
|
||
const timeline = room.getLiveTimeline(); | ||
|
||
// Check legacy events first, because it's cheaper. | ||
if ( | ||
timeline | ||
.getState(EventTimeline.FORWARDS) | ||
?.events?.has(EventType.GroupCallMemberPrefix) | ||
) { | ||
return true; | ||
} | ||
|
||
// There was call membership events at some point in the timeline. | ||
return timeline.getEvents().some( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is this method exactly? Try some heuristic to see if a room is a call room? like Or if there might be an active call? |
||
(e) => | ||
// Membership events only count if both of these are true | ||
e.unstableStickyInfo && e.getType() === EventType.GroupCallMemberPrefix, | ||
); | ||
// Otherwise, it's *unlikely* this room was ever a call. | ||
}; | ||
|
||
export function useGroupCallRooms(client: MatrixClient): GroupCallRoom[] { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no API to get the sticky events? Having the sticky key doesn't make the event sticky.
I am a bit lost with what this method is expecting to do