Start separating authentication from connection to collab (#35471)

This pull request should be idempotent, but lays the groundwork for
avoiding to connect to collab in order to interact with AI features
provided by Zed.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Co-authored-by: Richard Feldman <oss@rtfeldman.com>
This commit is contained in:
Antonio Scandurra 2025-08-01 19:37:38 +02:00 committed by GitHub
parent b01d1872cc
commit f888f3fc0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 653 additions and 855 deletions

View file

@ -2331,7 +2331,7 @@ impl CollabPanel {
let client = this.client.clone();
cx.spawn_in(window, async move |_, cx| {
client
.authenticate_and_connect(true, &cx)
.connect(true, &cx)
.await
.into_response()
.notify_async_err(cx);

View file

@ -634,13 +634,13 @@ impl Render for NotificationPanel {
.child(Icon::new(IconName::Envelope)),
)
.map(|this| {
if self.client.user_id().is_none() {
if !self.client.status().borrow().is_connected() {
this.child(
v_flex()
.gap_2()
.p_4()
.child(
Button::new("sign_in_prompt_button", "Sign in")
Button::new("connect_prompt_button", "Connect")
.icon_color(Color::Muted)
.icon(IconName::Github)
.icon_position(IconPosition::Start)
@ -652,10 +652,7 @@ impl Render for NotificationPanel {
let client = client.clone();
window
.spawn(cx, async move |cx| {
match client
.authenticate_and_connect(true, &cx)
.await
{
match client.connect(true, &cx).await {
util::ConnectionResult::Timeout => {
log::error!("Connection timeout");
}
@ -673,7 +670,7 @@ impl Render for NotificationPanel {
)
.child(
div().flex().w_full().items_center().child(
Label::new("Sign in to view notifications.")
Label::new("Connect to view notifications.")
.color(Color::Muted)
.size(LabelSize::Small),
),