diff --git a/migrations/2021-04-24-115720_remove_version_authors/down.sql b/migrations/2021-04-24-115720_remove_version_authors/down.sql new file mode 100644 index 00000000000..0e76493e792 --- /dev/null +++ b/migrations/2021-04-24-115720_remove_version_authors/down.sql @@ -0,0 +1,7 @@ +CREATE TABLE version_authors( + id SERIAL NOT NULL CONSTRAINT version_authors_pkey PRIMARY KEY, + version_id INTEGER NOT NULL CONSTRAINT fk_version_authors_version_id REFERENCES versions ON DELETE CASCADE, + name VARCHAR NOT NULL +); + +CREATE INDEX index_version_authors_version_id ON version_authors (version_id); diff --git a/migrations/2021-04-24-115720_remove_version_authors/up.sql b/migrations/2021-04-24-115720_remove_version_authors/up.sql new file mode 100644 index 00000000000..23548d7c357 --- /dev/null +++ b/migrations/2021-04-24-115720_remove_version_authors/up.sql @@ -0,0 +1 @@ +DROP TABLE version_authors; \ No newline at end of file diff --git a/mirage/factories/version.js b/mirage/factories/version.js index a0fc91a6db3..7b0f59408fa 100644 --- a/mirage/factories/version.js +++ b/mirage/factories/version.js @@ -14,7 +14,6 @@ export default Factory.extend({ downloads: i => (((i + 13) * 42) % 13) * 1234, features: () => {}, - _authors: () => [], crate_size: i => (((i + 13) * 42) % 13) * 54321, diff --git a/mirage/fixtures/versions.js b/mirage/fixtures/versions.js index ed26bc28e88..fcf26e4a9b5 100644 --- a/mirage/fixtures/versions.js +++ b/mirage/fixtures/versions.js @@ -12,16 +12,6 @@ export default [ yanked: false, license: 'MIT', crate_size: 912355, - _authors: [ - 'Daniel Fagnan ', - 'Jason E. Aten', - 'David C. Bishop', - 'Dennis Lawler', - 'Zachary Tong', - 'Dan Burkert', - 'Benoît Labaere ', - 'Chip Collier', - ], }, { crateId: 'nanomsg', @@ -36,16 +26,6 @@ export default [ updated_at: '2016-12-27T08:40:00Z', yanked: false, license: 'Apache-2.0', - _authors: [ - 'Daniel Fagnan ', - 'Jason E. Aten', - 'David C. Bishop', - 'Dennis Lawler', - 'Zachary Tong', - 'Dan Burkert', - 'Benoît Labaere ', - 'Chip Collier', - ], }, { crateId: 'nanomsg', @@ -57,16 +37,6 @@ export default [ updated_at: '2016-06-10T20:03:55Z', yanked: false, license: 'Apache-2.0', - _authors: [ - 'Daniel Fagnan ', - 'Jason E. Aten', - 'David C. Bishop', - 'Dennis Lawler', - 'Zachary Tong', - 'Dan Burkert', - 'Benoît Labaere ', - 'Chip Collier', - ], }, { crateId: 'nanomsg', @@ -78,16 +48,6 @@ export default [ updated_at: '2016-01-24T22:07:58Z', yanked: false, license: 'MIT/Apache-2.0', - _authors: [ - 'Daniel Fagnan ', - 'Jason E. Aten', - 'David C. Bishop', - 'Dennis Lawler', - 'Zachary Tong', - 'Dan Burkert', - 'Benoît Labaere ', - 'Chip Collier', - ], }, { crateId: 'nanomsg', @@ -99,16 +59,6 @@ export default [ updated_at: '2015-12-16T00:01:56Z', yanked: false, license: 'MIT', - _authors: [ - 'Daniel Fagnan ', - 'Jason E. Aten', - 'David C. Bishop', - 'Dennis Lawler', - 'Zachary Tong', - 'Dan Burkert', - 'Benoît Labaere ', - 'Chip Collier', - ], }, { crateId: 'nanomsg', @@ -120,16 +70,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [ - 'Daniel Fagnan ', - 'Jason E. Aten', - 'David C. Bishop', - 'Dennis Lawler', - 'Zachary Tong', - 'Dan Burkert', - 'Benoît Labaere ', - 'Chip Collier', - ], }, { crateId: 'nanomsg', @@ -141,16 +81,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [ - 'Daniel Fagnan ', - 'Jason E. Aten', - 'David C. Bishop', - 'Dennis Lawler', - 'Zachary Tong', - 'Dan Burkert', - 'Benoît Labaere ', - 'Chip Collier', - ], }, { crateId: 'nanomsg', @@ -162,16 +92,6 @@ export default [ updated_at: '2015-12-15T00:03:39Z', yanked: false, license: 'MIT', - _authors: [ - 'Daniel Fagnan ', - 'Jason E. Aten', - 'David C. Bishop', - 'Dennis Lawler', - 'Zachary Tong', - 'Dan Burkert', - 'Benoît Labaere ', - 'Chip Collier', - ], }, { crateId: 'nanomsg', @@ -183,16 +103,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [ - 'Daniel Fagnan ', - 'Jason E. Aten', - 'David C. Bishop', - 'Dennis Lawler', - 'Zachary Tong', - 'Dan Burkert', - 'Benoît Labaere ', - 'Chip Collier', - ], }, { crateId: 'nanomsg', @@ -204,16 +114,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'Apache-2.0', - _authors: [ - 'Daniel Fagnan ', - 'Jason E. Aten', - 'David C. Bishop', - 'Dennis Lawler', - 'Zachary Tong', - 'Dan Burkert', - 'Benoît Labaere ', - 'Chip Collier', - ], }, { crateId: 'nanomsg', @@ -225,16 +125,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT/Apache-2.0', - _authors: [ - 'Daniel Fagnan ', - 'Jason E. Aten', - 'David C. Bishop', - 'Dennis Lawler', - 'Zachary Tong', - 'Dan Burkert', - 'Benoît Labaere ', - 'Chip Collier', - ], }, { crateId: 'nanomsg', @@ -246,16 +136,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [ - 'Daniel Fagnan ', - 'Jason E. Aten', - 'David C. Bishop', - 'Dennis Lawler', - 'Zachary Tong', - 'Dan Burkert', - 'Benoît Labaere ', - 'Chip Collier', - ], }, { crateId: 'nanomsg', @@ -267,16 +147,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [ - 'Daniel Fagnan ', - 'Jason E. Aten', - 'David C. Bishop', - 'Dennis Lawler', - 'Zachary Tong', - 'Dan Burkert', - 'Benoît Labaere ', - 'Chip Collier', - ], }, { crateId: 'unicorn-rpc', @@ -288,7 +158,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: ['David C. Bishop'], }, { crateId: 'external_mixin', @@ -299,7 +168,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'external_mixin_umbrella', @@ -310,7 +178,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'Inflector', @@ -321,7 +188,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'kinetic-rust', @@ -332,7 +198,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'libc', @@ -343,7 +208,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'mock-build-deps', @@ -354,7 +218,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'mock-dev-deps', @@ -365,7 +228,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'nanomsg-sys', @@ -376,7 +238,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'nom', @@ -387,7 +248,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'postgres', @@ -398,7 +258,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'quickcheck', @@ -409,7 +268,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'quickcheck_macros', @@ -420,7 +278,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'rs-es', @@ -431,7 +288,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'rust-crypto', @@ -442,7 +298,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'rust-htslib', @@ -453,7 +308,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'rust_mixin', @@ -464,7 +318,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'rusted_cypher', @@ -475,7 +328,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'rustful', @@ -486,7 +338,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'rustless', @@ -497,7 +348,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'serde', @@ -508,7 +358,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'zlib', @@ -519,7 +368,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'rustful', @@ -530,7 +378,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'rustful', @@ -541,7 +388,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'rustful', @@ -552,7 +398,6 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, { crateId: 'rustful', @@ -563,6 +408,5 @@ export default [ updated_at: '2015-12-11T23:54:29Z', yanked: false, license: 'MIT', - _authors: [], }, ]; diff --git a/mirage/route-handlers/crates.js b/mirage/route-handlers/crates.js index 836a33afc81..f11f828ae6f 100644 --- a/mirage/route-handlers/crates.js +++ b/mirage/route-handlers/crates.js @@ -135,7 +135,7 @@ export function register(server) { let version = schema.versions.findBy({ crateId, num }); if (!version) return { errors: [{ detail: `crate \`${crateId}\` does not have a version \`${num}\`` }] }; - return { meta: { names: version._authors }, users: [] }; + return { meta: { names: [] }, users: [] }; }); server.get('/api/v1/crates/:crate_id/:version_num/dependencies', (schema, request) => { diff --git a/mirage/serializers/version.js b/mirage/serializers/version.js index c1eb5888628..abcb21c4e81 100644 --- a/mirage/serializers/version.js +++ b/mirage/serializers/version.js @@ -21,7 +21,6 @@ export default BaseSerializer.extend({ links(version) { return { - authors: `/api/v1/crates/${version.crateId}/${version.num}/authors`, dependencies: `/api/v1/crates/${version.crateId}/${version.num}/dependencies`, version_downloads: `/api/v1/crates/${version.crateId}/${version.num}/downloads`, }; diff --git a/src/bin/monitor.rs b/src/bin/monitor.rs index 65b8964ad72..c543d8891b4 100644 --- a/src/bin/monitor.rs +++ b/src/bin/monitor.rs @@ -110,7 +110,6 @@ fn check_stalled_update_downloads(conn: &PgConnection) -> Result<()> { fn check_spam_attack(conn: &PgConnection) -> Result<()> { use cargo_registry::models::krate::canon_crate_name; use diesel::dsl::*; - use diesel::sql_types::Bool; const EVENT_KEY: &str = "spam_attack"; @@ -121,11 +120,6 @@ fn check_spam_attack(conn: &PgConnection) -> Result<()> { .as_ref() .map(|s| s.split(',').collect()) .unwrap_or_default(); - let bad_author_patterns = dotenv::var("SPAM_AUTHOR_PATTERNS"); - let bad_author_patterns: Vec<_> = bad_author_patterns - .as_ref() - .map(|s| s.split(',').collect()) - .unwrap_or_default(); let mut event_description = None; @@ -139,19 +133,6 @@ fn check_spam_attack(conn: &PgConnection) -> Result<()> { event_description = Some(format!("Crate named {} published", bad_crate)); } - let mut query = version_authors::table - .select(version_authors::name) - .filter(false.into_sql::()) // Never return anything if we have no patterns - .into_boxed(); - for author_pattern in bad_author_patterns { - query = query.or_filter(version_authors::name.like(author_pattern)); - } - let bad_author: Option = query.first(conn).optional()?; - - if let Some(bad_author) = bad_author { - event_description = Some(format!("Crate with author {} published", bad_author)); - } - let event = if let Some(event_description) = event_description { on_call::Event::Trigger { incident_key: Some(EVENT_KEY.into()), diff --git a/src/controllers/krate/publish.rs b/src/controllers/krate/publish.rs index 80a5506ea86..83f0679d5af 100644 --- a/src/controllers/krate/publish.rs +++ b/src/controllers/krate/publish.rs @@ -160,7 +160,7 @@ pub fn publish(req: &mut dyn RequestExt) -> EndpointResult { file_length as i32, user.id, )? - .save(&conn, &new_crate.authors, &verified_email_address)?; + .save(&conn, &verified_email_address)?; insert_version_owner_action( &conn, diff --git a/src/downloads_counter.rs b/src/downloads_counter.rs index 939d85f5dee..b02a6e42047 100644 --- a/src/downloads_counter.rs +++ b/src/downloads_counter.rs @@ -452,7 +452,7 @@ mod tests { self.user.id, ) .expect("failed to create version") - .save(conn, &[], "ghost@example.com") + .save(conn, "ghost@example.com") .expect("failed to save version"); self.next_version += 1; diff --git a/src/models/version.rs b/src/models/version.rs index 489c38a2964..920ea8d8ae6 100644 --- a/src/models/version.rs +++ b/src/models/version.rs @@ -136,13 +136,7 @@ impl NewVersion { Ok(new_version) } - pub fn save( - &self, - conn: &PgConnection, - authors: &[String], - published_by_email: &str, - ) -> AppResult { - use crate::schema::version_authors::{name, version_id}; + pub fn save(&self, conn: &PgConnection, published_by_email: &str) -> AppResult { use crate::schema::versions::dsl::*; use diesel::dsl::exists; use diesel::{insert_into, select}; @@ -167,15 +161,6 @@ impl NewVersion { versions_published_by::email.eq(published_by_email), )) .execute(conn)?; - - let new_authors = authors - .iter() - .map(|s| (version_id.eq(version.id), name.eq(s))) - .collect::>(); - - insert_into(version_authors::table) - .values(&new_authors) - .execute(conn)?; Ok(version) }) } diff --git a/src/schema.patch b/src/schema.patch index c64bcd13d39..1ba2baca8f9 100644 --- a/src/schema.patch +++ b/src/schema.patch @@ -61,9 +61,9 @@ index df884e4..18e08cd 100644 joinable!(publish_rate_overrides -> users (user_id)); joinable!(readme_renderings -> versions (version_id)); +joinable!(recent_crate_downloads -> crates (crate_id)); - joinable!(version_authors -> versions (version_id)); joinable!(version_downloads -> versions (version_id)); joinable!(version_owner_actions -> api_tokens (api_token_id)); + joinable!(version_owner_actions -> users (user_id)); @@ -1043,6 +1059,7 @@ publish_limit_buckets, publish_rate_overrides, diff --git a/src/schema.rs b/src/schema.rs index 1570beccb2b..b1d09d0dc6d 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -814,35 +814,6 @@ table! { } } -table! { - use diesel::sql_types::*; - use diesel_full_text_search::{TsVector as Tsvector}; - - /// Representation of the `version_authors` table. - /// - /// (Automatically generated by Diesel.) - version_authors (id) { - /// The `id` column of the `version_authors` table. - /// - /// Its SQL type is `Int4`. - /// - /// (Automatically generated by Diesel.) - id -> Int4, - /// The `version_id` column of the `version_authors` table. - /// - /// Its SQL type is `Int4`. - /// - /// (Automatically generated by Diesel.) - version_id -> Int4, - /// The `name` column of the `version_authors` table. - /// - /// Its SQL type is `Varchar`. - /// - /// (Automatically generated by Diesel.) - name -> Varchar, - } -} - table! { use diesel::sql_types::*; use diesel_full_text_search::{TsVector as Tsvector}; @@ -1050,7 +1021,6 @@ joinable!(publish_limit_buckets -> users (user_id)); joinable!(publish_rate_overrides -> users (user_id)); joinable!(readme_renderings -> versions (version_id)); joinable!(recent_crate_downloads -> crates (crate_id)); -joinable!(version_authors -> versions (version_id)); joinable!(version_downloads -> versions (version_id)); joinable!(version_owner_actions -> api_tokens (api_token_id)); joinable!(version_owner_actions -> users (user_id)); @@ -1081,7 +1051,6 @@ allow_tables_to_appear_in_same_query!( reserved_crate_names, teams, users, - version_authors, version_downloads, version_owner_actions, versions, diff --git a/src/tasks/dump_db/dump-db.toml b/src/tasks/dump_db/dump-db.toml index 8658adc7b5e..7cb89b77ce2 100644 --- a/src/tasks/dump_db/dump-db.toml +++ b/src/tasks/dump_db/dump-db.toml @@ -179,13 +179,6 @@ account_lock_until = "private" [users.column_defaults] gh_access_token = "''" -[version_authors] -dependencies = ["versions"] -[version_authors.columns] -id = "public" -version_id = "public" -name = "public" - [version_downloads] dependencies = ["versions"] [version_downloads.columns] diff --git a/src/tasks/update_downloads.rs b/src/tasks/update_downloads.rs index def473812d2..01bdf8643e9 100644 --- a/src/tasks/update_downloads.rs +++ b/src/tasks/update_downloads.rs @@ -110,7 +110,7 @@ mod test { user_id, ) .unwrap(); - let version = version.save(conn, &[], "someone@example.com").unwrap(); + let version = version.save(conn, "someone@example.com").unwrap(); (krate, version) } diff --git a/src/tests/builders/publish.rs b/src/tests/builders/publish.rs index 6066c0037dc..4b72c452716 100644 --- a/src/tests/builders/publish.rs +++ b/src/tests/builders/publish.rs @@ -24,7 +24,6 @@ lazy_static! { /// a crate to exist and don't need to test behavior caused by the publish request, inserting /// a crate into the database directly by using CrateBuilder will be faster. pub struct PublishBuilder { - authors: Vec, badges: HashMap>, categories: Vec, deps: Vec, @@ -44,7 +43,6 @@ impl PublishBuilder { /// in its tarball. pub fn new(krate_name: &str) -> Self { PublishBuilder { - authors: vec!["foo".to_string()], badges: HashMap::new(), categories: vec![], deps: vec![], @@ -168,25 +166,12 @@ impl PublishBuilder { self } - /// Add an author to this crate - pub fn author(mut self, author: &str) -> Self { - self.authors.push(author.into()); - self - } - - /// Remove the authors from this crate. Publish will fail unless authors are reset. - pub fn unset_authors(mut self) -> Self { - self.authors = vec![]; - self - } - pub fn build(self) -> (String, Vec) { let new_crate = u::EncodableCrateUpload { name: u::EncodableCrateName(self.krate_name.clone()), vers: u::EncodableCrateVersion(self.version), features: HashMap::new(), deps: self.deps, - authors: self.authors, description: self.desc, homepage: None, documentation: self.doc_url, diff --git a/src/tests/builders/version.rs b/src/tests/builders/version.rs index 134997d160f..3de84f966d4 100644 --- a/src/tests/builders/version.rs +++ b/src/tests/builders/version.rs @@ -92,7 +92,7 @@ impl<'a> VersionBuilder<'a> { self.size, published_by, )? - .save(connection, &[], "someone@example.com")?; + .save(connection, "someone@example.com")?; if self.yanked { vers = update(&vers) diff --git a/src/tests/krate/publish.rs b/src/tests/krate/publish.rs index d3cfa8fb3ed..8860d8ff45c 100644 --- a/src/tests/krate/publish.rs +++ b/src/tests/krate/publish.rs @@ -703,7 +703,7 @@ fn bad_keywords() { assert_eq!(response.status(), StatusCode::OK); assert_eq!( response.json(), - json!({ "errors": [{ "detail": "invalid upload request: invalid length 29, expected a keyword with less than 20 characters at line 1 column 221" }] }) + json!({ "errors": [{ "detail": "invalid upload request: invalid length 29, expected a keyword with less than 20 characters at line 1 column 203" }] }) ); let crate_to_publish = PublishBuilder::new("foo_bad_key").keyword("?@?%"); @@ -711,7 +711,7 @@ fn bad_keywords() { assert_eq!(response.status(), StatusCode::OK); assert_eq!( response.json(), - json!({ "errors": [{ "detail": "invalid upload request: invalid value: string \"?@?%\", expected a valid keyword specifier at line 1 column 196" }] }) + json!({ "errors": [{ "detail": "invalid upload request: invalid value: string \"?@?%\", expected a valid keyword specifier at line 1 column 178" }] }) ); let crate_to_publish = PublishBuilder::new("foo_bad_key").keyword("áccênts"); @@ -719,7 +719,7 @@ fn bad_keywords() { assert_eq!(response.status(), StatusCode::OK); assert_eq!( response.json(), - json!({ "errors": [{ "detail": "invalid upload request: invalid value: string \"áccênts\", expected a valid keyword specifier at line 1 column 201" }] }) + json!({ "errors": [{ "detail": "invalid upload request: invalid value: string \"áccênts\", expected a valid keyword specifier at line 1 column 183" }] }) ); } @@ -824,8 +824,7 @@ fn license_and_description_required() { let crate_to_publish = PublishBuilder::new("foo_metadata") .version("1.1.0") .unset_license() - .unset_description() - .unset_authors(); + .unset_description(); let response = token.enqueue_publish(crate_to_publish); assert_eq!(response.status(), StatusCode::OK); @@ -836,9 +835,7 @@ fn license_and_description_required() { let crate_to_publish = PublishBuilder::new("foo_metadata") .version("1.1.0") - .unset_description() - .unset_authors() - .author(""); + .unset_description(); let response = token.enqueue_publish(crate_to_publish); assert_eq!(response.status(), StatusCode::OK); diff --git a/src/views.rs b/src/views.rs index dd62408d815..3ea1b4010f3 100644 --- a/src/views.rs +++ b/src/views.rs @@ -624,7 +624,6 @@ impl EncodableVersion { links: EncodableVersionLinks { dependencies: format!("/api/v1/crates/{}/{}/dependencies", crate_name, num), version_downloads: format!("/api/v1/crates/{}/{}/downloads", crate_name, num), - authors: format!("/api/v1/crates/{}/{}/authors", crate_name, num), }, crate_size, published_by: published_by.map(User::into), @@ -644,7 +643,6 @@ impl EncodableVersion { pub struct EncodableVersionLinks { pub dependencies: String, pub version_downloads: String, - pub authors: String, } #[derive(Serialize, Deserialize, Debug)] @@ -734,7 +732,6 @@ mod tests { links: EncodableVersionLinks { dependencies: "".to_string(), version_downloads: "".to_string(), - authors: "".to_string(), }, crate_size: Some(1234), published_by: None, diff --git a/src/views/krate_publish.rs b/src/views/krate_publish.rs index 6a28f5c763e..62cfeb9cfc4 100644 --- a/src/views/krate_publish.rs +++ b/src/views/krate_publish.rs @@ -18,7 +18,6 @@ pub struct EncodableCrateUpload { pub vers: EncodableCrateVersion, pub deps: Vec, pub features: HashMap>, - pub authors: Vec, pub description: Option, pub homepage: Option, pub documentation: Option, diff --git a/tests/mirage/crates-test.js b/tests/mirage/crates-test.js index 31b97db96ef..b69c864aba5 100644 --- a/tests/mirage/crates-test.js +++ b/tests/mirage/crates-test.js @@ -286,7 +286,6 @@ module('Mirage | Crates', function (hooks) { downloads: 0, license: 'MIT/Apache-2.0', links: { - authors: '/api/v1/crates/rand/1.0.0-beta.1/authors', dependencies: '/api/v1/crates/rand/1.0.0-beta.1/dependencies', version_downloads: '/api/v1/crates/rand/1.0.0-beta.1/downloads', }, @@ -320,7 +319,6 @@ module('Mirage | Crates', function (hooks) { downloads: 0, license: 'MIT/Apache-2.0', links: { - authors: '/api/v1/crates/rand/1.0.0/authors', dependencies: '/api/v1/crates/rand/1.0.0/dependencies', version_downloads: '/api/v1/crates/rand/1.0.0/downloads', }, @@ -338,7 +336,6 @@ module('Mirage | Crates', function (hooks) { downloads: 3702, license: 'MIT', links: { - authors: '/api/v1/crates/rand/1.1.0/authors', dependencies: '/api/v1/crates/rand/1.1.0/dependencies', version_downloads: '/api/v1/crates/rand/1.1.0/downloads', }, @@ -356,7 +353,6 @@ module('Mirage | Crates', function (hooks) { downloads: 7404, license: 'Apache-2.0', links: { - authors: '/api/v1/crates/rand/1.2.0/authors', dependencies: '/api/v1/crates/rand/1.2.0/dependencies', version_downloads: '/api/v1/crates/rand/1.2.0/downloads', }, @@ -586,7 +582,6 @@ module('Mirage | Crates', function (hooks) { downloads: 0, license: 'MIT/Apache-2.0', links: { - authors: '/api/v1/crates/rand/1.0.0/authors', dependencies: '/api/v1/crates/rand/1.0.0/dependencies', version_downloads: '/api/v1/crates/rand/1.0.0/downloads', }, @@ -604,7 +599,6 @@ module('Mirage | Crates', function (hooks) { downloads: 3702, license: 'MIT', links: { - authors: '/api/v1/crates/rand/1.1.0/authors', dependencies: '/api/v1/crates/rand/1.1.0/dependencies', version_downloads: '/api/v1/crates/rand/1.1.0/downloads', }, @@ -628,7 +622,6 @@ module('Mirage | Crates', function (hooks) { downloads: 7404, license: 'Apache-2.0', links: { - authors: '/api/v1/crates/rand/1.2.0/authors', dependencies: '/api/v1/crates/rand/1.2.0/dependencies', version_downloads: '/api/v1/crates/rand/1.2.0/downloads', }, @@ -680,10 +673,8 @@ module('Mirage | Crates', function (hooks) { }); test('returns a list of authors belonging to the specified crate version', async function (assert) { - let authors = ['John Doe ', 'The Rust Project Developers']; - this.server.create('crate', { name: 'rand' }); - this.server.create('version', { crateId: 'rand', num: '1.0.0', _authors: authors }); + this.server.create('version', { crateId: 'rand', num: '1.0.0' }); let response = await fetch('/api/v1/crates/rand/1.0.0/authors'); assert.equal(response.status, 200); @@ -691,7 +682,7 @@ module('Mirage | Crates', function (hooks) { let responsePayload = await response.json(); assert.deepEqual(responsePayload, { meta: { - names: authors, + names: [], }, users: [], }); @@ -1025,7 +1016,6 @@ module('Mirage | Crates', function (hooks) { downloads: 0, license: 'MIT/Apache-2.0', links: { - authors: '/api/v1/crates/bar/1.0.0/authors', dependencies: '/api/v1/crates/bar/1.0.0/dependencies', version_downloads: '/api/v1/crates/bar/1.0.0/downloads', }, @@ -1043,7 +1033,6 @@ module('Mirage | Crates', function (hooks) { downloads: 3702, license: 'MIT', links: { - authors: '/api/v1/crates/baz/1.0.1/authors', dependencies: '/api/v1/crates/baz/1.0.1/dependencies', version_downloads: '/api/v1/crates/baz/1.0.1/downloads', }, diff --git a/tests/mirage/me-test.js b/tests/mirage/me-test.js index b1f013f02a4..d36d1877005 100644 --- a/tests/mirage/me-test.js +++ b/tests/mirage/me-test.js @@ -236,7 +236,6 @@ module('Mirage | /me', function (hooks) { downloads: 0, license: 'MIT/Apache-2.0', links: { - authors: '/api/v1/crates/foo/1.2.3/authors', dependencies: '/api/v1/crates/foo/1.2.3/dependencies', version_downloads: '/api/v1/crates/foo/1.2.3/downloads', },