Show current user avatar when in a room, even if not in a shared project (#3546)

This commit is contained in:
Max Brunsfeld 2023-12-07 15:22:29 -08:00 committed by GitHub
commit 0b78a401de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,12 +88,8 @@ impl Render for CollabTitlebarItem {
.child(self.render_project_name(cx)) .child(self.render_project_name(cx))
.children(self.render_project_branch(cx)) .children(self.render_project_branch(cx))
.when_some( .when_some(
current_user current_user.clone().zip(client.peer_id()).zip(room.clone()),
.clone() |this, ((current_user, peer_id), room)| {
.zip(client.peer_id())
.zip(room.clone())
.zip(project_id),
|this, (((current_user, peer_id), room), project_id)| {
let player_colors = cx.theme().players(); let player_colors = cx.theme().players();
let room = room.read(cx); let room = room.read(cx);
let mut remote_participants = let mut remote_participants =
@ -103,7 +99,7 @@ impl Render for CollabTitlebarItem {
this.children(self.render_collaborator( this.children(self.render_collaborator(
&current_user, &current_user,
peer_id, peer_id,
ParticipantLocation::SharedProject { project_id }, true,
room.is_speaking(), room.is_speaking(),
room.is_muted(cx), room.is_muted(cx),
&room, &room,
@ -112,10 +108,15 @@ impl Render for CollabTitlebarItem {
)) ))
.children( .children(
remote_participants.iter().filter_map(|collaborator| { remote_participants.iter().filter_map(|collaborator| {
let is_present = project_id.map_or(false, |project_id| {
collaborator.location
== ParticipantLocation::SharedProject { project_id }
});
let face_pile = self.render_collaborator( let face_pile = self.render_collaborator(
&collaborator.user, &collaborator.user,
collaborator.peer_id, collaborator.peer_id,
collaborator.location.clone(), is_present,
collaborator.speaking, collaborator.speaking,
collaborator.muted, collaborator.muted,
&room, &room,
@ -412,14 +413,14 @@ impl CollabTitlebarItem {
&self, &self,
user: &Arc<User>, user: &Arc<User>,
peer_id: PeerId, peer_id: PeerId,
location: ParticipantLocation, is_present: bool,
is_speaking: bool, is_speaking: bool,
is_muted: bool, is_muted: bool,
room: &Room, room: &Room,
project_id: u64, project_id: Option<u64>,
current_user: &Arc<User>, current_user: &Arc<User>,
) -> Option<FacePile> { ) -> Option<FacePile> {
let followers = room.followers_for(peer_id, project_id); let followers = project_id.map_or(&[] as &[_], |id| room.followers_for(peer_id, id));
let mut pile = FacePile::default(); let mut pile = FacePile::default();
pile.extend( pile.extend(
user.avatar user.avatar
@ -428,9 +429,7 @@ impl CollabTitlebarItem {
div() div()
.child( .child(
Avatar::data(avatar.clone()) Avatar::data(avatar.clone())
.grayscale( .grayscale(!is_present)
location != ParticipantLocation::SharedProject { project_id },
)
.border_color(if is_speaking { .border_color(if is_speaking {
gpui::blue() gpui::blue()
} else if is_muted { } else if is_muted {