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

@ -8,12 +8,14 @@ use postage::{sink::Sink, watch};
use rpc::proto::{RequestMessage, UsersResponse};
use std::sync::{Arc, Weak};
use text::ReplicaId;
use theme::ColorIndex;
use util::http::HttpClient;
use util::TryFutureExt as _;
pub type UserId = u64;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ParticipantIndex(pub u32);
#[derive(Default, Debug)]
pub struct User {
pub id: UserId,
@ -65,7 +67,7 @@ pub enum ContactRequestStatus {
pub struct UserStore {
users: HashMap<u64, Arc<User>>,
color_indices: HashMap<u64, ColorIndex>,
participant_indices: HashMap<u64, ParticipantIndex>,
update_contacts_tx: mpsc::UnboundedSender<UpdateContacts>,
current_user: watch::Receiver<Option<Arc<User>>>,
contacts: Vec<Arc<Contact>>,
@ -91,7 +93,7 @@ pub enum Event {
kind: ContactEventKind,
},
ShowContacts,
ColorIndicesChanged,
ParticipantIndicesChanged,
}
#[derive(Clone, Copy)]
@ -129,7 +131,7 @@ impl UserStore {
current_user: current_user_rx,
contacts: Default::default(),
incoming_contact_requests: Default::default(),
color_indices: Default::default(),
participant_indices: Default::default(),
outgoing_contact_requests: Default::default(),
invite_info: None,
client: Arc::downgrade(&client),
@ -654,19 +656,19 @@ impl UserStore {
})
}
pub fn set_color_indices(
pub fn set_participant_indices(
&mut self,
color_indices: HashMap<u64, ColorIndex>,
participant_indices: HashMap<u64, ParticipantIndex>,
cx: &mut ModelContext<Self>,
) {
if color_indices != self.color_indices {
self.color_indices = color_indices;
cx.emit(Event::ColorIndicesChanged);
if participant_indices != self.participant_indices {
self.participant_indices = participant_indices;
cx.emit(Event::ParticipantIndicesChanged);
}
}
pub fn color_indices(&self) -> &HashMap<u64, ColorIndex> {
&self.color_indices
pub fn participant_indices(&self) -> &HashMap<u64, ParticipantIndex> {
&self.participant_indices
}
}