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

Raise crate deletion download limit #10266

Merged
merged 1 commit into from
Dec 30, 2024
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
2 changes: 1 addition & 1 deletion app/templates/crate/delete.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<li>
<ul>
<li>the crate only has a single owner, and</li>
<li>the crate has been downloaded less than 100 times for each month it has been published, and</li>
<li>the crate has been downloaded less than 500 times for each month it has been published, and</li>
<li>the crate is not depended upon by any other crate on crates.io.</li>
</ul>
</li>
Expand Down
6 changes: 3 additions & 3 deletions src/controllers/krate/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use diesel_async::{AsyncConnection, AsyncPgConnection, RunQueryDsl};
use http::request::Parts;
use http::StatusCode;

const DOWNLOADS_PER_MONTH_LIMIT: u64 = 100;
const DOWNLOADS_PER_MONTH_LIMIT: u64 = 500;
const AVAILABLE_AFTER: TimeDelta = TimeDelta::hours(24);

/// Delete a crate.
Expand All @@ -25,7 +25,7 @@ const AVAILABLE_AFTER: TimeDelta = TimeDelta::hours(24);
///
/// The crate can only be deleted by the owner of the crate, and only if the
/// crate has been published for less than 72 hours, or if the crate has a
/// single owner, has been downloaded less than 100 times for each month it has
/// single owner, has been downloaded less than 500 times for each month it has
/// been published, and is not depended upon by any other crate on crates.io.
#[utoipa::path(
delete,
Expand Down Expand Up @@ -384,7 +384,7 @@ mod tests {

let response = delete_crate(&user, "foo").await;
assert_eq!(response.status(), StatusCode::UNPROCESSABLE_ENTITY);
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"only crates with less than 100 downloads per month can be deleted after 72 hours"}]}"#);
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"only crates with less than 500 downloads per month can be deleted after 72 hours"}]}"#);

assert_crate_exists(&anon, "foo", true).await;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ snapshot_kind: text
},
"/api/v1/crates/{name}": {
"delete": {
"description": "The crate is immediately deleted from the database, and with a small delay\nfrom the git and sparse index, and the crate file storage.\n\nThe crate can only be deleted by the owner of the crate, and only if the\ncrate has been published for less than 72 hours, or if the crate has a\nsingle owner, has been downloaded less than 100 times for each month it has\nbeen published, and is not depended upon by any other crate on crates.io.",
"description": "The crate is immediately deleted from the database, and with a small delay\nfrom the git and sparse index, and the crate file storage.\n\nThe crate can only be deleted by the owner of the crate, and only if the\ncrate has been published for less than 72 hours, or if the crate has a\nsingle owner, has been downloaded less than 500 times for each month it has\nbeen published, and is not depended upon by any other crate on crates.io.",
"operationId": "delete_crate",
"parameters": [
{
Expand Down
Loading