Rename color_index to participant_index

Co-authored-by: Conrad <conrad@zed.dev>
This commit is contained in:
Max Brunsfeld 2023-09-28 11:18:29 -07:00
parent 545b5e0161
commit 0f39b63801
17 changed files with 97 additions and 80 deletions

View file

@ -1,4 +1,5 @@
use anyhow::{anyhow, Result};
use client::ParticipantIndex;
use client::{proto, User};
use collections::HashMap;
use gpui::WeakModelHandle;
@ -6,7 +7,6 @@ pub use live_kit_client::Frame;
use live_kit_client::RemoteAudioTrack;
use project::Project;
use std::{fmt, sync::Arc};
use theme::ColorIndex;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum ParticipantLocation {
@ -44,7 +44,7 @@ pub struct RemoteParticipant {
pub peer_id: proto::PeerId,
pub projects: Vec<proto::ParticipantProject>,
pub location: ParticipantLocation,
pub color_index: ColorIndex,
pub participant_index: ParticipantIndex,
pub muted: bool,
pub speaking: bool,
pub video_tracks: HashMap<live_kit_client::Sid, Arc<RemoteVideoTrack>>,

View file

@ -7,7 +7,7 @@ use anyhow::{anyhow, Result};
use audio::{Audio, Sound};
use client::{
proto::{self, PeerId},
Client, TypedEnvelope, User, UserStore,
Client, ParticipantIndex, TypedEnvelope, User, UserStore,
};
use collections::{BTreeMap, HashMap, HashSet};
use fs::Fs;
@ -21,7 +21,6 @@ use live_kit_client::{
use postage::stream::Stream;
use project::Project;
use std::{future::Future, mem, pin::Pin, sync::Arc, time::Duration};
use theme::ColorIndex;
use util::{post_inc, ResultExt, TryFutureExt};
pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30);
@ -715,7 +714,9 @@ impl Room {
participant.user_id,
RemoteParticipant {
user: user.clone(),
color_index: ColorIndex(participant.color_index),
participant_index: ParticipantIndex(
participant.participant_index,
),
peer_id,
projects: participant.projects,
location,
@ -810,12 +811,12 @@ impl Room {
}
this.user_store.update(cx, |user_store, cx| {
let color_indices_by_user_id = this
let participant_indices_by_user_id = this
.remote_participants
.iter()
.map(|(user_id, participant)| (*user_id, participant.color_index))
.map(|(user_id, participant)| (*user_id, participant.participant_index))
.collect();
user_store.set_color_indices(color_indices_by_user_id, cx);
user_store.set_participant_indices(participant_indices_by_user_id, cx);
});
this.check_invariants();