mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-27 12:54:42 +00:00
Use Db::get_guest_connection_ids
in other db methods
This commit is contained in:
parent
9eee22ff0a
commit
532a599239
1 changed files with 6 additions and 51 deletions
|
@ -1771,24 +1771,9 @@ where
|
||||||
query.execute(&mut tx).await?;
|
query.execute(&mut tx).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let connection_ids = sqlx::query_scalar::<_, i32>(
|
let connection_ids = self.get_guest_connection_ids(project_id, &mut tx).await?;
|
||||||
"
|
|
||||||
SELECT connection_id
|
|
||||||
FROM project_collaborators
|
|
||||||
WHERE project_id = $1 AND connection_id != $2
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.bind(project_id)
|
|
||||||
.bind(connection_id.0 as i32)
|
|
||||||
.fetch_all(&mut tx)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
tx.commit().await?;
|
tx.commit().await?;
|
||||||
|
Ok(connection_ids)
|
||||||
Ok(connection_ids
|
|
||||||
.into_iter()
|
|
||||||
.map(|connection_id| ConnectionId(connection_id as u32))
|
|
||||||
.collect())
|
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
@ -1846,24 +1831,9 @@ where
|
||||||
.execute(&mut tx)
|
.execute(&mut tx)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let connection_ids = sqlx::query_scalar::<_, i32>(
|
let connection_ids = self.get_guest_connection_ids(project_id, &mut tx).await?;
|
||||||
"
|
|
||||||
SELECT connection_id
|
|
||||||
FROM project_collaborators
|
|
||||||
WHERE project_id = $1 AND connection_id != $2
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.bind(project_id)
|
|
||||||
.bind(connection_id.0 as i32)
|
|
||||||
.fetch_all(&mut tx)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
tx.commit().await?;
|
tx.commit().await?;
|
||||||
|
Ok(connection_ids)
|
||||||
Ok(connection_ids
|
|
||||||
.into_iter()
|
|
||||||
.map(|connection_id| ConnectionId(connection_id as u32))
|
|
||||||
.collect())
|
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
@ -1908,24 +1878,9 @@ where
|
||||||
.execute(&mut tx)
|
.execute(&mut tx)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let connection_ids = sqlx::query_scalar::<_, i32>(
|
let connection_ids = self.get_guest_connection_ids(project_id, &mut tx).await?;
|
||||||
"
|
|
||||||
SELECT connection_id
|
|
||||||
FROM project_collaborators
|
|
||||||
WHERE project_id = $1 AND connection_id != $2
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.bind(project_id)
|
|
||||||
.bind(connection_id.0 as i32)
|
|
||||||
.fetch_all(&mut tx)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
tx.commit().await?;
|
tx.commit().await?;
|
||||||
|
Ok(connection_ids)
|
||||||
Ok(connection_ids
|
|
||||||
.into_iter()
|
|
||||||
.map(|connection_id| ConnectionId(connection_id as u32))
|
|
||||||
.collect())
|
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue