Skip to content

Stop saving badges in the database #5074

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

Merged
merged 1 commit into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
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
9 changes: 3 additions & 6 deletions src/controllers/krate/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use swirl::Job;

use crate::controllers::cargo_prelude::*;
use crate::models::{
insert_version_owner_action, Badge, Category, Crate, DependencyKind, Keyword, NewCrate,
NewVersion, Rights, VersionAction,
insert_version_owner_action, Category, Crate, DependencyKind, Keyword, NewCrate, NewVersion,
Rights, VersionAction,
};
use crate::worker;

Expand Down Expand Up @@ -186,9 +186,6 @@ pub fn publish(req: &mut dyn RequestExt) -> EndpointResult {
// in order to be able to warn about them
let ignored_invalid_categories = Category::update_crate(&conn, &krate, &categories)?;

// Update all badges for this crate, collecting any invalid badges in
// order to be able to warn about them
let ignored_invalid_badges = Badge::update_crate(&conn, &krate, new_crate.badges.as_ref())?;
let top_versions = krate.top_versions(&conn)?;

// Read tarball from request
Expand Down Expand Up @@ -248,7 +245,7 @@ pub fn publish(req: &mut dyn RequestExt) -> EndpointResult {
// warnings at this time, but if we need to, the field is available.
let warnings = PublishWarnings {
invalid_categories: ignored_invalid_categories,
invalid_badges: ignored_invalid_badges,
invalid_badges: vec![],
other: vec![],
};

Expand Down
10 changes: 1 addition & 9 deletions src/tests/krate/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,15 +813,7 @@ fn ignored_badges() {
let json = token.publish_crate(crate_to_publish).good();
assert_eq!(json.krate.name, "foo_ignored_badge");
assert_eq!(json.krate.max_version, "1.0.0");
assert_eq!(json.warnings.invalid_badges.len(), 2);
assert!(json
.warnings
.invalid_badges
.contains(&"travis-ci".to_string(),));
assert!(json
.warnings
.invalid_badges
.contains(&"not-a-badge".to_string(),));
assert_eq!(json.warnings.invalid_badges.len(), 0);

let json = anon.show_crate("foo_ignored_badge");
let badges = json.krate.badges.unwrap();
Expand Down