-
Notifications
You must be signed in to change notification settings - Fork 94
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
Disambiguate displaynames #2918
base: livekit
Are you sure you want to change the base?
Conversation
*/ | ||
public readonly memberDisplaynames$ = fromEvent( | ||
this.matrixRTCSession, | ||
MatrixRTCSessionEvent.MembershipsChanged, |
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.
Do we emit this if a display name changes?
Very minor but otherwise we will not update the memberDisplaynames
if a user changes their name.
const rawDisplayName = member?.rawDisplayName; | ||
if ( | ||
shouldDisambiguate(rawDisplayName, member.userId, memberships, room) | ||
) { | ||
displaynameMap.set( | ||
livekitParticipantId, | ||
`${member.rawDisplayName} (${member.userId})`, | ||
); | ||
} else { | ||
displaynameMap.set(livekitParticipantId, member.rawDisplayName); | ||
} | ||
} |
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.
Only this logic is really new. The rest is duplicated from mediaItems$
right?
I think one of the following could work:
- create a fn:
getRoomMemberFor(rtcMember)
and use this here and for mediaItems. (It also would need to return the participant? - create a BehaviorSubject for
memberDisplaynames$
and update it when updating themediaItems$
@@ -54,15 +55,23 @@ vi.mock("@livekit/components-core"); | |||
|
|||
const localRtcMember = mockRtcMembership("@carol:example.org", "CCCC"); | |||
const aliceRtcMember = mockRtcMembership("@alice:example.org", "AAAA"); | |||
const aliceDopplegangerRtcMember = mockRtcMembership( |
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.
const aliceDopplegangerRtcMember = mockRtcMembership( | |
const aliceDoppelgangerRtcMember = mockRtcMembership( |
const bobRtcMember = mockRtcMembership("@bob:example.org", "BBBB"); | ||
const daveRtcMember = mockRtcMembership("@dave:example.org", "DDDD"); | ||
|
||
const alice = mockMatrixRoomMember(aliceRtcMember); | ||
const alice = mockMatrixRoomMember(aliceRtcMember, { rawDisplayName: "Alice" }); | ||
const aliceDoppleganger = mockMatrixRoomMember(aliceDopplegangerRtcMember, { |
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.
const aliceDoppleganger = mockMatrixRoomMember(aliceDopplegangerRtcMember, { | |
const aliceDoppelganger = mockMatrixRoomMember(aliceDopplegangerRtcMember, { |
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.
It makes more sense if you change/refactor this in an ide. All occurances of Doppleganger
b: [aliceRtcMember], | ||
c: [aliceRtcMember, aliceDopplegangerRtcMember], | ||
d: [aliceRtcMember, aliceDopplegangerRtcMember, bobRtcMember], | ||
e: [aliceDopplegangerRtcMember, bobRtcMember], |
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.
How hard would it be to add the other cases: LTR/RTL
and display name formatted like an impersonation?
Fixes #2746
This adds a new observer for member displaynames and updates usages of the old hook to use the view model. I'm currently copying the
shouldDisambiguate
function from Element Web as we want to operate on call members, not all room members (and the changes felt too specific to us to incorporate upstream).Either way, this works quite nicely and responsively.
That said, maybe this would be good to be included in
MatrixRTCSession
?