Skip to content

Commit

Permalink
Auto merge of #3539 - hi-rustin:rustin-patch-fix, r=jtgeibel
Browse files Browse the repository at this point in the history
Return the empty list for authors API

Part of rust-lang/rust#83227 (comment)

Stop returning authorship information from the API, changing the endpoint to always return an empty list.
  • Loading branch information
bors committed Apr 23, 2021
2 parents 14e38f1 + 53479ff commit 11707b6
Showing 1 changed file with 3 additions and 14 deletions.
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

0 comments on commit 11707b6

Please sign in to comment.