Remove unused ids query parameter from GET /extensions endpoint (#13802)

This PR removes the `ids` query parameter from the `GET /extensions`
endpoint, as we don't use it.

We originally added the query parameter in #9929 to facilitate
auto-updates. However, it was superseded by the `GET
/extensions/updates` endpoint in #10052.

There shouldn't be any Zed versions out in the wild that are using the
`ids` query parameter, as we added the endpoint on Thursday, March 28,
and replaced its usage with the new endpoint on Monday, April 1, before
the next Zed release.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-07-03 19:03:49 -04:00 committed by GitHub
parent 8ec478cbcd
commit 52583fe1ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,8 +36,6 @@ pub fn router() -> Router {
struct GetExtensionsParams {
filter: Option<String>,
#[serde(default)]
ids: Option<String>,
#[serde(default)]
max_schema_version: i32,
}
@ -45,26 +43,15 @@ async fn get_extensions(
Extension(app): Extension<Arc<AppState>>,
Query(params): Query<GetExtensionsParams>,
) -> Result<Json<GetExtensionsResponse>> {
let extension_ids = params
.ids
.as_ref()
.map(|s| s.split(',').map(|s| s.trim()).collect::<Vec<_>>());
let extensions = app
.db
.get_extensions(params.filter.as_deref(), params.max_schema_version, 500)
.await?;
let extensions = if let Some(extension_ids) = extension_ids {
app.db.get_extensions_by_ids(&extension_ids, None).await?
} else {
let result = app
.db
.get_extensions(params.filter.as_deref(), params.max_schema_version, 500)
.await?;
if let Some(query) = params.filter.as_deref() {
let count = result.len();
tracing::info!(query, count, "extension_search")
}
result
};
if let Some(query) = params.filter.as_deref() {
let count = extensions.len();
tracing::info!(query, count, "extension_search")
}
Ok(Json(GetExtensionsResponse { data: extensions }))
}