Prefer names over github logins when filling co-authors (#24693)

Kirill Bulatov created

Follow-up of https://github.com/zed-industries/zed/pull/24575

Release Notes:

- N/A

Change summary

crates/git_ui/src/git_panel.rs | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

Detailed changes

crates/git_ui/src/git_panel.rs 🔗

@@ -789,7 +789,14 @@ impl GitPanel {
                 let email = participant.user.email.clone().unwrap();
 
                 if !existing_co_authors.contains(&email.as_ref()) {
-                    new_co_authors.push((participant.user.github_login.clone(), email))
+                    new_co_authors.push((
+                        participant
+                            .user
+                            .name
+                            .clone()
+                            .unwrap_or_else(|| participant.user.github_login.clone()),
+                        email,
+                    ))
                 }
             }
         }
@@ -797,7 +804,12 @@ impl GitPanel {
             if let Some(user) = room.local_participant_user(cx) {
                 if let Some(email) = user.email.clone() {
                     if !existing_co_authors.contains(&email.as_ref()) {
-                        new_co_authors.push((user.github_login.clone(), email.clone()))
+                        new_co_authors.push((
+                            user.name
+                                .clone()
+                                .unwrap_or_else(|| user.github_login.clone()),
+                            email.clone(),
+                        ))
                     }
                 }
             }