Check for predict-edits feature flag, remove is_staff check (#23165)

Release Notes:

- N/A

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
This commit is contained in:
Agus Zubiaga 2025-01-15 10:52:10 -03:00 committed by GitHub
parent da8e65b3e5
commit 4a7630204a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 21 additions and 11 deletions

View file

@ -440,8 +440,11 @@ async fn predict_edits(
_country_code_header: Option<TypedHeader<CloudflareIpCountryHeader>>,
Json(params): Json<PredictEditsParams>,
) -> Result<impl IntoResponse> {
if !claims.is_staff {
return Err(anyhow!("not found"))?;
if !claims.is_staff && !claims.has_predict_edits_feature_flag {
return Err(Error::http(
StatusCode::FORBIDDEN,
"no access to Zed's edit prediction feature".to_string(),
));
}
let api_url = state