Set staff user property in telemetry

Co-authored-by: Joseph Lyons <joseph@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-10-03 10:52:57 -07:00
parent 761ae3ae6f
commit 4477f95ee6
7 changed files with 49 additions and 15 deletions

View file

@ -1738,7 +1738,16 @@ impl Server {
.await
.user_id_for_connection(request.sender_id)?;
let metrics_id = self.app_state.db.get_user_metrics_id(user_id).await?;
response.send(proto::GetPrivateUserInfoResponse { metrics_id })?;
let user = self
.app_state
.db
.get_user_by_id(user_id)
.await?
.ok_or_else(|| anyhow!("user not found"))?;
response.send(proto::GetPrivateUserInfoResponse {
metrics_id,
staff: user.admin,
})?;
Ok(())
}