Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

client: Add `username` to `User` and start using it (#60107)

Marshall Bowers53e4d34a71f6
diff --git a/crates/channel/src/channel_store.rs b/crates/channel/src/channel_store.rs
index e73809e6047..7d6632de4a7 100644
--- a/crates/channel/src/channel_store.rs
+++ b/crates/channel/src/channel_store.rs
@@ -124,7 +124,7 @@ impl ChannelMembership {
proto::channel_member::Kind::Member => 0,
proto::channel_member::Kind::Invitee => 1,
},
- username_order: &self.user.github_login,
+ username_order: &self.user.username,
}
}
}
diff --git a/crates/client/src/user.rs b/crates/client/src/user.rs
index a2a8bf18d2a..898a810e533 100644
--- a/crates/client/src/user.rs
+++ b/crates/client/src/user.rs
@@ -56,7 +56,7 @@ pub struct ParticipantIndex(pub u32);
#[derive(Default, Debug)]
pub struct User {
pub legacy_id: LegacyUserId,
- pub github_login: SharedString,
+ pub username: SharedString,
pub avatar_uri: SharedUri,
pub name: Option<String>,
}
@@ -79,13 +79,13 @@ impl PartialOrd for User {
impl Ord for User {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
- self.github_login.cmp(&other.github_login)
+ self.username.cmp(&other.username)
}
}
impl PartialEq for User {
fn eq(&self, other: &Self) -> bool {
- self.legacy_id == other.legacy_id && self.github_login == other.github_login
+ self.legacy_id == other.legacy_id && self.username == other.username
}
}
@@ -237,7 +237,7 @@ impl UserStore {
let current_user_and_response = if let Some(response) = response {
let user = Arc::new(User {
legacy_id: user_id,
- github_login: response.user.github_login.clone().into(),
+ username: response.user.username.clone().into(),
avatar_uri: response.user.avatar_url.clone().into(),
name: response.user.name.clone(),
});
@@ -400,10 +400,11 @@ impl UserStore {
.retain(|contact| !removed_contacts.contains(&contact.user.legacy_id));
// Update existing contacts and insert new ones
for updated_contact in updated_contacts {
- match this.contacts.binary_search_by_key(
- &&updated_contact.user.github_login,
- |contact| &contact.user.github_login,
- ) {
+ match this
+ .contacts
+ .binary_search_by_key(&&updated_contact.user.username, |contact| {
+ &contact.user.username
+ }) {
Ok(ix) => this.contacts[ix] = updated_contact,
Err(ix) => this.contacts.insert(ix, updated_contact),
}
@@ -425,9 +426,8 @@ impl UserStore {
for user in incoming_requests {
match this
.incoming_contact_requests
- .binary_search_by_key(&&user.github_login, |contact| {
- &contact.github_login
- }) {
+ .binary_search_by_key(&&user.username, |contact| &contact.username)
+ {
Ok(ix) => this.incoming_contact_requests[ix] = user,
Err(ix) => this.incoming_contact_requests.insert(ix, user),
}
@@ -440,8 +440,8 @@ impl UserStore {
for request in outgoing_requests {
match this
.outgoing_contact_requests
- .binary_search_by_key(&&request.github_login, |contact| {
- &contact.github_login
+ .binary_search_by_key(&&request.username, |contact| {
+ &contact.username
}) {
Ok(ix) => this.outgoing_contact_requests[ix] = request,
Err(ix) => this.outgoing_contact_requests.insert(ix, request),
@@ -463,7 +463,7 @@ impl UserStore {
pub fn has_contact(&self, user: &Arc<User>) -> bool {
self.contacts
- .binary_search_by_key(&&user.github_login, |contact| &contact.user.github_login)
+ .binary_search_by_key(&&user.username, |contact| &contact.user.username)
.is_ok()
}
@@ -482,19 +482,19 @@ impl UserStore {
pub fn contact_request_status(&self, user: &User) -> ContactRequestStatus {
if self
.contacts
- .binary_search_by_key(&&user.github_login, |contact| &contact.user.github_login)
+ .binary_search_by_key(&&user.username, |contact| &contact.user.username)
.is_ok()
{
ContactRequestStatus::RequestAccepted
} else if self
.outgoing_contact_requests
- .binary_search_by_key(&&user.github_login, |user| &user.github_login)
+ .binary_search_by_key(&&user.username, |user| &user.username)
.is_ok()
{
ContactRequestStatus::RequestSent
} else if self
.incoming_contact_requests
- .binary_search_by_key(&&user.github_login, |user| &user.github_login)
+ .binary_search_by_key(&&user.username, |user| &user.username)
.is_ok()
{
ContactRequestStatus::RequestReceived
@@ -986,8 +986,8 @@ impl UserStore {
let mut ret = HashMap::default();
let mut missing_user_ids = Vec::new();
for id in user_ids {
- if let Some(github_login) = self.get_cached_user(id).map(|u| u.github_login.clone()) {
- ret.insert(id, github_login);
+ if let Some(username) = self.get_cached_user(id).map(|u| u.username.clone()) {
+ ret.insert(id, username);
} else {
missing_user_ids.push(id)
}
@@ -1008,7 +1008,7 @@ impl User {
fn new(message: proto::User) -> Arc<Self> {
Arc::new(User {
legacy_id: message.id,
- github_login: message.github_login.into(),
+ username: message.username.into(),
avatar_uri: message.avatar_url.into(),
name: message.name,
})
diff --git a/crates/collab/tests/integration/collab_tests.rs b/crates/collab/tests/integration/collab_tests.rs
index 8f72035c433..c4c9f4d7d84 100644
--- a/crates/collab/tests/integration/collab_tests.rs
+++ b/crates/collab/tests/integration/collab_tests.rs
@@ -35,12 +35,12 @@ fn room_participants(room: &Entity<Room>, cx: &mut TestAppContext) -> RoomPartic
let mut remote = room
.remote_participants()
.values()
- .map(|participant| participant.user.github_login.clone().to_string())
+ .map(|participant| participant.user.username.clone().to_string())
.collect::<Vec<_>>();
let mut pending = room
.pending_participants()
.iter()
- .map(|user| user.github_login.clone().to_string())
+ .map(|user| user.username.clone().to_string())
.collect::<Vec<_>>();
remote.sort();
pending.sort();
diff --git a/crates/collab/tests/integration/editor_tests.rs b/crates/collab/tests/integration/editor_tests.rs
index 142c00cff5d..28f9cd15758 100644
--- a/crates/collab/tests/integration/editor_tests.rs
+++ b/crates/collab/tests/integration/editor_tests.rs
@@ -1881,7 +1881,7 @@ async fn test_share_project(
let incoming_call_b = active_call_b.read_with(cx_b, |call, _| call.incoming());
executor.run_until_parked();
let call = incoming_call_b.borrow().clone().unwrap();
- assert_eq!(call.calling_user.github_login, "user_a");
+ assert_eq!(call.calling_user.username, "user_a");
let initial_project = call.initial_project.unwrap();
active_call_b
.update(cx_b, |call, cx| call.accept_incoming(cx))
@@ -1997,7 +1997,7 @@ async fn test_share_project(
let incoming_call_c = active_call_c.read_with(cx_c, |call, _| call.incoming());
executor.run_until_parked();
let call = incoming_call_c.borrow().clone().unwrap();
- assert_eq!(call.calling_user.github_login, "user_b");
+ assert_eq!(call.calling_user.username, "user_b");
let initial_project = call.initial_project.unwrap();
active_call_c
.update(cx_c, |call, cx| call.accept_incoming(cx))
diff --git a/crates/collab/tests/integration/integration_tests.rs b/crates/collab/tests/integration/integration_tests.rs
index dac33f9855b..c4650971d2a 100644
--- a/crates/collab/tests/integration/integration_tests.rs
+++ b/crates/collab/tests/integration/integration_tests.rs
@@ -126,7 +126,7 @@ async fn test_basic_calls(
let mut incoming_call_b = active_call_b.read_with(cx_b, |call, _| call.incoming());
let call_b = incoming_call_b.next().await.unwrap().unwrap();
- assert_eq!(call_b.calling_user.github_login, "user_a");
+ assert_eq!(call_b.calling_user.username, "user_a");
// User B connects via another client and also receives a ring on the newly-connected client.
let _client_b2 = server.create_client(cx_b2, "user_b").await;
@@ -135,7 +135,7 @@ async fn test_basic_calls(
let mut incoming_call_b2 = active_call_b2.read_with(cx_b2, |call, _| call.incoming());
executor.run_until_parked();
let call_b2 = incoming_call_b2.next().await.unwrap().unwrap();
- assert_eq!(call_b2.calling_user.github_login, "user_a");
+ assert_eq!(call_b2.calling_user.username, "user_a");
// User B joins the room using the first client.
active_call_b
@@ -190,7 +190,7 @@ async fn test_basic_calls(
// User C receives the call, but declines it.
let call_c = incoming_call_c.next().await.unwrap().unwrap();
- assert_eq!(call_c.calling_user.github_login, "user_b");
+ assert_eq!(call_c.calling_user.username, "user_b");
active_call_c.update(cx_c, |call, cx| call.decline_incoming(cx).unwrap());
assert!(incoming_call_c.next().await.unwrap().is_none());
@@ -236,7 +236,7 @@ async fn test_basic_calls(
// User C accepts the call.
let call_c = incoming_call_c.next().await.unwrap().unwrap();
- assert_eq!(call_c.calling_user.github_login, "user_a");
+ assert_eq!(call_c.calling_user.username, "user_a");
active_call_c
.update(cx_c, |call, cx| call.accept_incoming(cx))
.await
@@ -677,7 +677,7 @@ async fn test_room_uniqueness(
let mut incoming_call_b = active_call_b.read_with(cx_b, |call, _| call.incoming());
let call_b1 = incoming_call_b.next().await.unwrap().unwrap();
- assert_eq!(call_b1.calling_user.github_login, "user_a");
+ assert_eq!(call_b1.calling_user.username, "user_a");
// Ensure calling users A and B from client C fails.
active_call_c
@@ -739,7 +739,7 @@ async fn test_room_uniqueness(
.unwrap();
executor.run_until_parked();
let call_b2 = incoming_call_b.next().await.unwrap().unwrap();
- assert_eq!(call_b2.calling_user.github_login, "user_c");
+ assert_eq!(call_b2.calling_user.username, "user_c");
}
#[gpui::test(iterations = 10)]
@@ -1873,7 +1873,7 @@ async fn test_active_call_events(
vec![room::Event::RemoteProjectShared {
owner: Arc::new(User {
legacy_id: client_a.user_id().unwrap(),
- github_login: "user_a".into(),
+ username: "user_a".into(),
avatar_uri: "avatar_a".into(),
name: None,
}),
@@ -1892,7 +1892,7 @@ async fn test_active_call_events(
vec![room::Event::RemoteProjectShared {
owner: Arc::new(User {
legacy_id: client_b.user_id().unwrap(),
- github_login: "user_b".into(),
+ username: "user_b".into(),
avatar_uri: "avatar_b".into(),
name: None,
}),
@@ -2281,12 +2281,7 @@ async fn test_room_location(
room.read_with(cx, |room, _| {
room.remote_participants()
.values()
- .map(|participant| {
- (
- participant.user.github_login.to_string(),
- participant.location,
- )
- })
+ .map(|participant| (participant.user.username.to_string(), participant.location))
.collect()
})
}
@@ -6393,7 +6388,7 @@ async fn test_contacts(
.iter()
.map(|contact| {
(
- contact.user.github_login.clone().to_string(),
+ contact.user.username.clone().to_string(),
if contact.online { "online" } else { "offline" },
if contact.busy { "busy" } else { "free" },
)
@@ -6629,7 +6624,7 @@ async fn test_join_call_after_screen_was_shared(
let mut incoming_call_b = active_call_b.read_with(cx_b, |call, _| call.incoming());
let call_b = incoming_call_b.next().await.unwrap().unwrap();
- assert_eq!(call_b.calling_user.github_login, "user_a");
+ assert_eq!(call_b.calling_user.username, "user_a");
// User A shares their screen
let display = gpui::TestScreenCaptureSource::new();
diff --git a/crates/collab/tests/integration/test_server.rs b/crates/collab/tests/integration/test_server.rs
index de4c4a4e165..62169c9a938 100644
--- a/crates/collab/tests/integration/test_server.rs
+++ b/crates/collab/tests/integration/test_server.rs
@@ -725,17 +725,17 @@ impl TestClient {
current: store
.contacts()
.iter()
- .map(|contact| contact.user.github_login.clone().to_string())
+ .map(|contact| contact.user.username.clone().to_string())
.collect(),
outgoing_requests: store
.outgoing_contact_requests()
.iter()
- .map(|user| user.github_login.clone().to_string())
+ .map(|user| user.username.clone().to_string())
.collect(),
incoming_requests: store
.incoming_contact_requests()
.iter()
- .map(|user| user.github_login.clone().to_string())
+ .map(|user| user.username.clone().to_string())
.collect(),
})
}
diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rs
index 0958587a5ca..6a0a32c3933 100644
--- a/crates/collab_ui/src/collab_panel.rs
+++ b/crates/collab_ui/src/collab_panel.rs
@@ -606,7 +606,7 @@ impl CollabPanel {
if let Some(user) = self.user_store.read(cx).current_user() {
self.match_candidates.clear();
self.match_candidates
- .push(StringMatchCandidate::new(0, &user.github_login));
+ .push(StringMatchCandidate::new(0, &user.username));
let matches = fg_executor.block_on(match_strings(
&self.match_candidates,
&query,
@@ -648,7 +648,7 @@ impl CollabPanel {
.extend(room.remote_participants().values().map(|participant| {
StringMatchCandidate::new(
participant.user.legacy_id as usize,
- &participant.user.github_login,
+ &participant.user.username,
)
}));
let mut matches = fg_executor.block_on(match_strings(
@@ -697,12 +697,14 @@ impl CollabPanel {
// Populate pending participants.
self.match_candidates.clear();
- self.match_candidates
- .extend(room.pending_participants().iter().enumerate().map(
- |(id, participant)| {
- StringMatchCandidate::new(id, &participant.github_login)
- },
- ));
+ self.match_candidates.extend(
+ room.pending_participants()
+ .iter()
+ .enumerate()
+ .map(|(id, participant)| {
+ StringMatchCandidate::new(id, &participant.username)
+ }),
+ );
let matches = fg_executor.block_on(match_strings(
&self.match_candidates,
&query,
@@ -936,7 +938,7 @@ impl CollabPanel {
incoming
.iter()
.enumerate()
- .map(|(ix, user)| StringMatchCandidate::new(ix, &user.github_login)),
+ .map(|(ix, user)| StringMatchCandidate::new(ix, &user.username)),
);
let matches = fg_executor.block_on(match_strings(
&self.match_candidates,
@@ -961,7 +963,7 @@ impl CollabPanel {
outgoing
.iter()
.enumerate()
- .map(|(ix, user)| StringMatchCandidate::new(ix, &user.github_login)),
+ .map(|(ix, user)| StringMatchCandidate::new(ix, &user.username)),
);
let matches = fg_executor.block_on(match_strings(
&self.match_candidates,
@@ -994,7 +996,7 @@ impl CollabPanel {
contacts
.iter()
.enumerate()
- .map(|(ix, contact)| StringMatchCandidate::new(ix, &contact.user.github_login)),
+ .map(|(ix, contact)| StringMatchCandidate::new(ix, &contact.user.username)),
);
let matches = fg_executor.block_on(match_strings(
@@ -1130,7 +1132,7 @@ impl CollabPanel {
.current_user()
.map(|user| user.legacy_id)
== Some(user_id);
- let tooltip = format!("Follow {}", user.github_login);
+ let tooltip = format!("Follow {}", user.username);
let is_call_admin = ActiveCall::global(cx).read(cx).room().is_some_and(|room| {
room.read(cx).local_participant().role == proto::ChannelRole::Admin
@@ -1154,7 +1156,7 @@ impl CollabPanel {
Empty.into_any_element()
};
- ListItem::new(user.github_login.clone())
+ ListItem::new(user.username.clone())
.start_slot(Avatar::new(user.avatar_uri.clone()))
.child(render_participant_name_and_handle(user))
.toggle_state(is_selected)
@@ -1659,9 +1661,9 @@ impl CollabPanel {
if contact.online && !contact.busy {
let label = if in_room {
- format!("Invite {} to join", contact.user.github_login)
+ format!("Invite {} to join", contact.user.username)
} else {
- format!("Call {}", contact.user.github_login)
+ format!("Call {}", contact.user.username)
};
context_menu = context_menu.entry(label, None, {
let this = this.clone();
@@ -1679,7 +1681,7 @@ impl CollabPanel {
this.update(cx, |this, cx| {
this.remove_contact(
contact.user.legacy_id,
- &contact.user.github_login,
+ &contact.user.username,
window,
cx,
);
@@ -3027,8 +3029,8 @@ impl CollabPanel {
) -> impl IntoElement {
let online = contact.online;
let busy = contact.busy || calling;
- let github_login = contact.user.github_login.clone();
- let item = ListItem::new(github_login.clone())
+ let username = contact.user.username.clone();
+ let item = ListItem::new(username.clone())
.indent_level(1)
.indent_step_size(px(20.))
.toggle_state(is_selected)
@@ -3079,20 +3081,20 @@ impl CollabPanel {
);
div()
- .id(github_login.clone())
+ .id(username.clone())
.group("")
.child(item)
.tooltip(move |_, cx| {
let text = if !online {
- format!(" {} is offline", &github_login)
+ format!(" {} is offline", &username)
} else if busy {
- format!(" {} is on a call", &github_login)
+ format!(" {} is on a call", &username)
} else {
let room = ActiveCall::global(cx).read(cx).room();
if room.is_some() {
- format!("Invite {} to join call", &github_login)
+ format!("Invite {} to join call", &username)
} else {
- format!("Call {}", &github_login)
+ format!("Call {}", &username)
}
};
Tooltip::simple(text, cx)
@@ -3106,7 +3108,7 @@ impl CollabPanel {
is_selected: bool,
cx: &mut Context<Self>,
) -> impl IntoElement {
- let github_login = user.github_login.clone();
+ let username = user.username.clone();
let user_id = user.legacy_id;
let is_response_pending = self.user_store.read(cx).is_contact_request_pending(user);
let color = if is_response_pending {
@@ -3131,7 +3133,7 @@ impl CollabPanel {
.tooltip(Tooltip::text("Accept invite")),
]
} else {
- let github_login = github_login.clone();
+ let github_login = username.clone();
vec![
IconButton::new("remove_contact", IconName::Close)
.on_click(cx.listener(move |this, _, window, cx| {
@@ -3142,7 +3144,7 @@ impl CollabPanel {
]
};
- ListItem::new(github_login.clone())
+ ListItem::new(username.clone())
.indent_level(1)
.indent_step_size(px(20.))
.toggle_state(is_selected)
@@ -3150,7 +3152,7 @@ impl CollabPanel {
h_flex()
.w_full()
.justify_between()
- .child(Label::new(github_login))
+ .child(Label::new(username))
.child(h_flex().children(controls)),
)
.start_slot(Avatar::new(user.avatar_uri.clone()))
@@ -3511,14 +3513,14 @@ impl CollabPanel {
let requester = user_store.get_cached_user(*sender_id)?;
Some((
Some(requester.clone()),
- format!("{} wants to add you as a contact", requester.github_login),
+ format!("{} wants to add you as a contact", requester.username),
))
}
Notification::ContactRequestAccepted { responder_id } => {
let responder = user_store.get_cached_user(*responder_id)?;
Some((
Some(responder.clone()),
- format!("{} accepted your contact request", responder.github_login),
+ format!("{} accepted your contact request", responder.username),
))
}
Notification::ChannelInvitation {
@@ -3531,7 +3533,7 @@ impl CollabPanel {
Some(inviter.clone()),
format!(
"{} invited you to join the #{channel_name} channel",
- inviter.github_login
+ inviter.username
),
))
}
@@ -3695,9 +3697,9 @@ fn render_tree_branch(
fn render_participant_name_and_handle(user: &User) -> impl IntoElement {
Label::new(if let Some(ref display_name) = user.name {
- format!("{display_name} ({})", user.github_login)
+ format!("{display_name} ({})", user.username)
} else {
- user.github_login.to_string()
+ user.username.to_string()
})
}
@@ -4128,7 +4130,7 @@ impl CollabPanel {
string_entries.push(format!(" (invite) #{}{selected_marker}", channel.name));
}
ListEntry::CallParticipant { user, .. } => {
- string_entries.push(format!(" {}{selected_marker}", user.github_login));
+ string_entries.push(format!(" {}{selected_marker}", user.username));
}
ListEntry::ParticipantProject {
worktree_root_names,
@@ -4143,20 +4145,13 @@ impl CollabPanel {
string_entries.push(format!(" (screen){selected_marker}"));
}
ListEntry::IncomingRequest(user) => {
- string_entries.push(format!(
- " (incoming) {}{selected_marker}",
- user.github_login
- ));
+ string_entries.push(format!(" (incoming) {}{selected_marker}", user.username));
}
ListEntry::OutgoingRequest(user) => {
- string_entries.push(format!(
- " (outgoing) {}{selected_marker}",
- user.github_login
- ));
+ string_entries.push(format!(" (outgoing) {}{selected_marker}", user.username));
}
ListEntry::Contact { contact, .. } => {
- string_entries
- .push(format!(" {}{selected_marker}", contact.user.github_login));
+ string_entries.push(format!(" {}{selected_marker}", contact.user.username));
}
ListEntry::ContactPlaceholder => {}
}
diff --git a/crates/collab_ui/src/collab_panel/channel_modal.rs b/crates/collab_ui/src/collab_panel/channel_modal.rs
index 94a843d5c16..6452d55d1ec 100644
--- a/crates/collab_ui/src/collab_panel/channel_modal.rs
+++ b/crates/collab_ui/src/collab_panel/channel_modal.rs
@@ -296,10 +296,11 @@ impl PickerDelegate for ChannelModalDelegate {
Mode::ManageMembers => {
if self.has_all_members {
self.match_candidates.clear();
- self.match_candidates
- .extend(self.members.iter().enumerate().map(|(id, member)| {
- StringMatchCandidate::new(id, &member.user.github_login)
- }));
+ self.match_candidates.extend(
+ self.members.iter().enumerate().map(|(id, member)| {
+ StringMatchCandidate::new(id, &member.user.username)
+ }),
+ );
let matches = cx.foreground_executor().block_on(match_strings(
&self.match_candidates,
@@ -422,7 +423,7 @@ impl PickerDelegate for ChannelModalDelegate {
.spacing(ListItemSpacing::Sparse)
.toggle_state(selected)
.start_slot(Avatar::new(user.avatar_uri.clone()))
- .child(Label::new(user.github_login.clone()))
+ .child(Label::new(user.username.clone()))
.end_slot(h_flex().gap_2().map(|slot| {
match self.mode {
Mode::ManageMembers => slot
diff --git a/crates/collab_ui/src/collab_panel/contact_finder.rs b/crates/collab_ui/src/collab_panel/contact_finder.rs
index 56eb7679a61..22c09b285b9 100644
--- a/crates/collab_ui/src/collab_panel/contact_finder.rs
+++ b/crates/collab_ui/src/collab_panel/contact_finder.rs
@@ -167,7 +167,7 @@ impl PickerDelegate for ContactFinderDelegate {
.spacing(ListItemSpacing::Sparse)
.toggle_state(selected)
.start_slot(Avatar::new(user.avatar_uri.clone()))
- .child(Label::new(user.github_login.clone()))
+ .child(Label::new(user.username.clone()))
.end_slot::<Icon>(icon_path.map(Icon::from_path)),
)
}
diff --git a/crates/collab_ui/src/notifications/incoming_call_notification.rs b/crates/collab_ui/src/notifications/incoming_call_notification.rs
index 089bcd5f73a..34e0b7716f4 100644
--- a/crates/collab_ui/src/notifications/incoming_call_notification.rs
+++ b/crates/collab_ui/src/notifications/incoming_call_notification.rs
@@ -127,7 +127,7 @@ impl Render for IncomingCallNotification {
)
.child(Label::new(format!(
"{} is sharing a project in Zed",
- self.state.call.calling_user.github_login
+ self.state.call.calling_user.username
))),
)
}
diff --git a/crates/collab_ui/src/notifications/project_shared_notification.rs b/crates/collab_ui/src/notifications/project_shared_notification.rs
index 99a920b7fe8..00e5080f832 100644
--- a/crates/collab_ui/src/notifications/project_shared_notification.rs
+++ b/crates/collab_ui/src/notifications/project_shared_notification.rs
@@ -126,7 +126,7 @@ impl Render for ProjectSharedNotification {
let punctuation = if no_worktree_root_names { "" } else { ":" };
let main_label = format!(
"{} is sharing a project with you{}",
- self.owner.github_login.clone(),
+ self.owner.username.clone(),
punctuation
);
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index 800058f25f9..7efa8f9b42a 100644
--- a/crates/git_ui/src/git_panel.rs
+++ b/crates/git_ui/src/git_panel.rs
@@ -3766,7 +3766,7 @@ impl GitPanel {
.committer_name
.clone()
.or_else(|| participant.user.name.clone())
- .unwrap_or_else(|| participant.user.github_login.clone().to_string());
+ .unwrap_or_else(|| participant.user.username.clone().to_string());
new_co_authors.push((name.clone(), email.clone()))
}
}
@@ -3788,7 +3788,7 @@ impl GitPanel {
.name
.clone()
.or_else(|| user.name.clone())
- .unwrap_or_else(|| user.github_login.clone().to_string());
+ .unwrap_or_else(|| user.username.clone().to_string());
Some((name, email))
}
diff --git a/crates/title_bar/src/collab.rs b/crates/title_bar/src/collab.rs
index ae503e4db75..3d498c6fd89 100644
--- a/crates/title_bar/src/collab.rs
+++ b/crates/title_bar/src/collab.rs
@@ -240,7 +240,7 @@ impl TitleBar {
})
.occlude()
.tooltip({
- let login = collaborator.user.github_login.clone();
+ let login = collaborator.user.username.clone();
Tooltip::text(format!("Follow {login}"))
}),
)
@@ -295,8 +295,8 @@ impl TitleBar {
avatar.indicator(
AvatarAudioStatusIndicator::new(ui::AudioStatus::Muted)
.tooltip({
- let github_login = user.github_login.clone();
- Tooltip::text(format!("{} is muted", github_login))
+ let username = user.username.clone();
+ Tooltip::text(format!("{} is muted", username))
}),
)
}),
diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs
index ed4848c59a8..8ccc710dbf8 100644
--- a/crates/title_bar/src/title_bar.rs
+++ b/crates/title_bar/src/title_bar.rs
@@ -755,13 +755,13 @@ impl TitleBar {
.get(&host_user.legacy_id)?;
Some(
- Button::new("project_owner_trigger", host_user.github_login.clone())
+ Button::new("project_owner_trigger", host_user.username.clone())
.color(Color::Player(participant_index.0))
.label_size(LabelSize::Small)
.tooltip(move |_, cx| {
let tooltip_title = format!(
"{} is sharing this project. Click to follow.",
- host_user.github_login
+ host_user.username
);
Tooltip::with_meta(tooltip_title, None, "Click to Follow", cx)
@@ -1216,7 +1216,7 @@ impl TitleBar {
let user = user_store.read(cx).current_user();
let user_avatar = user.as_ref().map(|u| u.avatar_uri.clone());
- let user_login = user.as_ref().map(|u| u.github_login.clone());
+ let username = user.as_ref().map(|u| u.username.clone());
let is_signed_in = user.is_some();
@@ -1268,7 +1268,7 @@ impl TitleBar {
PopoverMenu::new("user-menu")
.trigger(trigger)
.menu(move |window, cx| {
- let user_login = user_login.clone();
+ let username = username.clone();
let current_organization = current_organization.clone();
let organizations = organizations.clone();
let user_store = user_store.clone();
@@ -1282,15 +1282,15 @@ impl TitleBar {
ContextMenu::build(window, cx, |menu, _, _cx| {
menu.when(is_signed_in, |this| {
- let user_login = user_login.clone();
+ let username = username.clone();
this.custom_entry(
move |_window, _cx| {
- let user_login = user_login.clone().unwrap_or_default();
+ let username = username.clone().unwrap_or_default();
h_flex()
.w_full()
.justify_between()
- .child(Label::new(user_login))
+ .child(Label::new(username))
.into_any_element()
},
move |_, cx| {
diff --git a/crates/workspace/src/pane_group.rs b/crates/workspace/src/pane_group.rs
index 34304c46ab2..6b5a3cafaba 100644
--- a/crates/workspace/src/pane_group.rs
+++ b/crates/workspace/src/pane_group.rs
@@ -404,24 +404,24 @@ impl PaneLeaderDecorator for PaneRenderContext<'_> {
is_in_unshared_view.then(|| {
Label::new(format!(
"{} is in an unshared pane",
- leader.user.github_login
+ leader.user.username
))
})
} else {
leader_join_data = Some((leader_project_id, leader.user.legacy_id));
Some(Label::new(format!(
"Follow {} to their active project",
- leader.user.github_login,
+ leader.user.username,
)))
}
}
ParticipantLocation::UnsharedProject => Some(Label::new(format!(
"{} is viewing an unshared Zed project",
- leader.user.github_login
+ leader.user.username
))),
ParticipantLocation::External => Some(Label::new(format!(
"{} is viewing a window outside of Zed",
- leader.user.github_login
+ leader.user.username
))),
};
status_box = leader_status_box.map(|status| {
diff --git a/crates/workspace/src/shared_screen.rs b/crates/workspace/src/shared_screen.rs
index 41e8f41f2ad..bd7e3b40da1 100644
--- a/crates/workspace/src/shared_screen.rs
+++ b/crates/workspace/src/shared_screen.rs
@@ -64,7 +64,7 @@ impl Item for SharedScreen {
type Event = Event;
fn tab_tooltip_text(&self, _: &App) -> Option<SharedString> {
- Some(format!("{}'s screen", self.user.github_login).into())
+ Some(format!("{}'s screen", self.user.username).into())
}
fn deactivated(&mut self, _window: &mut Window, cx: &mut Context<Self>) {
@@ -78,7 +78,7 @@ impl Item for SharedScreen {
}
fn tab_content_text(&self, _detail: usize, _cx: &App) -> SharedString {
- format!("{}'s screen", self.user.github_login).into()
+ format!("{}'s screen", self.user.username).into()
}
fn telemetry_event_text(&self) -> Option<&'static str> {