collab: Treat staff as having usage-based pricing enabled (#30020)

This PR makes it so staff are treated as having opted-in to usage-based
pricing.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-05-06 12:06:03 -04:00 committed by GitHub
parent 6d2c39c265
commit a378b3f300
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2737,8 +2737,12 @@ async fn update_user_plan(user_id: UserId, session: &Session) -> Result<()> {
trial_started_at: billing_customer
.and_then(|billing_customer| billing_customer.trial_started_at)
.map(|trial_started_at| trial_started_at.and_utc().timestamp() as u64),
is_usage_based_billing_enabled: billing_preferences
.map(|preferences| preferences.model_request_overages_enabled),
is_usage_based_billing_enabled: if session.is_staff() {
Some(true)
} else {
billing_preferences
.map(|preferences| preferences.model_request_overages_enabled)
},
usage: usage.map(|usage| {
let plan = match plan {
proto::Plan::Free => zed_llm_client::Plan::Free,