mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 05:15:00 +00:00
Handle case where follower is local user
This commit is contained in:
parent
50e681bbb1
commit
1abb7794cb
1 changed files with 19 additions and 2 deletions
|
@ -505,6 +505,7 @@ impl CollabTitlebarItem {
|
||||||
cx: &mut RenderContext<Self>,
|
cx: &mut RenderContext<Self>,
|
||||||
) -> Vec<ElementBox> {
|
) -> Vec<ElementBox> {
|
||||||
let project = workspace.read(cx).project().read(cx);
|
let project = workspace.read(cx).project().read(cx);
|
||||||
|
|
||||||
let mut participants = room
|
let mut participants = room
|
||||||
.read(cx)
|
.read(cx)
|
||||||
.remote_participants()
|
.remote_participants()
|
||||||
|
@ -512,6 +513,7 @@ impl CollabTitlebarItem {
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
participants.sort_by_key(|p| Some(project.collaborators().get(&p.peer_id)?.replica_id));
|
participants.sort_by_key(|p| Some(project.collaborators().get(&p.peer_id)?.replica_id));
|
||||||
|
|
||||||
participants
|
participants
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|participant| {
|
.filter_map(|participant| {
|
||||||
|
@ -615,8 +617,23 @@ impl CollabTitlebarItem {
|
||||||
let followers = room.follows(peer_id);
|
let followers = room.follows(peer_id);
|
||||||
|
|
||||||
Some(followers.into_iter().flat_map(|&follower| {
|
Some(followers.into_iter().flat_map(|&follower| {
|
||||||
let participant = room.remote_participant_for_peer_id(follower)?;
|
let avatar = room
|
||||||
let avatar = participant.user.avatar.as_ref()?;
|
.remote_participant_for_peer_id(follower)
|
||||||
|
.and_then(|participant| participant.user.avatar.clone())
|
||||||
|
.or_else(|| {
|
||||||
|
if follower == workspace.read(cx).client().peer_id()? {
|
||||||
|
workspace
|
||||||
|
.read(cx)
|
||||||
|
.user_store()
|
||||||
|
.read(cx)
|
||||||
|
.current_user()?
|
||||||
|
.avatar
|
||||||
|
.clone()
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})?;
|
||||||
|
|
||||||
Some(Self::render_face(avatar.clone(), avatar_style, theme))
|
Some(Self::render_face(avatar.clone(), avatar_style, theme))
|
||||||
}))
|
}))
|
||||||
})()
|
})()
|
||||||
|
|
Loading…
Reference in a new issue