Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return the empty list for authors API #3539

Merged
merged 1 commit into from
Apr 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions src/controllers/version/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use crate::controllers::frontend_prelude::*;

use crate::models::VersionOwnerAction;
use crate::schema::*;
use crate::views::{EncodableDependency, EncodablePublicUser, EncodableVersion};

use super::{extract_crate_name_and_semver, version_and_crate};
Expand Down Expand Up @@ -38,18 +37,8 @@ pub fn dependencies(req: &mut dyn RequestExt) -> EndpointResult {

/// Handles the `GET /crates/:crate_id/:version/authors` route.
pub fn authors(req: &mut dyn RequestExt) -> EndpointResult {
let (crate_name, semver) = extract_crate_name_and_semver(req)?;
let conn = req.db_read_only()?;
let (version, _) = version_and_crate(&conn, crate_name, semver)?;
let names = version_authors::table
.filter(version_authors::version_id.eq(version.id))
.select(version_authors::name)
.order(version_authors::name)
.load(&*conn)?;

// It was imagined that we wold associate authors with users.
// This was never implemented. This complicated return struct
// is all that is left, hear for backwards compatibility.
// Currently we return the empty list.
// Because the API is not used anymore after RFC https://github.com/rust-lang/rfcs/pull/3052.
#[derive(Serialize)]
struct R {
users: Vec<EncodablePublicUser>,
Expand All @@ -61,7 +50,7 @@ pub fn authors(req: &mut dyn RequestExt) -> EndpointResult {
}
Ok(req.json(&R {
users: vec![],
meta: Meta { names },
meta: Meta { names: vec![] },
}))
}

Expand Down