-
Notifications
You must be signed in to change notification settings - Fork 643
Yanked crates shouldn't be displayed on user/team pages #958
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
Comments
…ersion This makes the index call only show crates that have at least one available version. Crates that have all versions yanked will not show up anymore. Fixes rust-lang#958
…ersion This makes the index call only show crates that have at least one available version. Crates that have all versions yanked will not show up anymore. Fixes rust-lang#958
…ersion This makes the index call only show crates that have at least one available version. Crates that have all versions yanked will not show up anymore. Fixes rust-lang#958
…ersion This makes the index call only show crates that have at least one available version. Crates that have all versions yanked will not show up anymore. Fixes rust-lang#958
…ersion This makes the index call only show crates that have at least one available version. Crates that have all versions yanked will not show up anymore. Fixes rust-lang#958
I'd like to give this a shot. |
Is there ever a case where we want the diff --git a/src/krate/search.rs b/src/krate/search.rs
index 3a8030a..dfa59d0 100644
--- a/src/krate/search.rs
+++ b/src/krate/search.rs
@@ -50,6 +50,11 @@ pub fn search(req: &mut Request) -> CargoResult<Response> {
let recent_downloads = sql::<Nullable<BigInt>>("SUM(crate_downloads.downloads)");
let mut query = crates::table
+ .filter(exists(
+ versions::table
+ .filter(versions::crate_id.eq(crates::id))
+ .filter(versions::yanked.eq(false)),
+ ))
.left_join(
crate_downloads::table.on(
crates::id |
Gotcha. In that case, the patch I pasted above should still work, but placed in the conditionals where we want it, rather than the line I have it on. |
Alternatively, that filter can become |
I've opened diesel-rs/diesel#1389 which might make that a bit easier as well (this PR shouldn't be blocked on that though) |
Should we use something like I took a shot at this using
from above in each of the However, I'm wondering if that's the most clear. Are we getting ourselves into a situation where we perform this logic if this is true, and that logic if that is true, and it gets tangled and confusing? What if each front-end route is allowed to specify whether it wants to show yanked versions or not, using I would suggest we include yanked crates by default because that is how all existing requests work. And then specifically update the The advantages are that whether or not to include or exclude yanked crates is somewhat orthogonal to the other requests, and having a specific parameter for this functionality would allow front-end code to choose whether to show yanked crates or not on a route-by-route basis. For example, I could see us wanting However, I haven't considered the database query time impact. And I could be convinced that this extensibility isn't buying us anything except complexity. Is this a path worth pursuing? I tried it out and I imagine it looking something like this: bryanburgers@1ebfc08 |
Add a URL parameter to the `/api/v1/crates` endpoint that specifies whether or not the endpoint should return crates that have been fully yanked - i.e., where every version has been yanked. If not specified, this defaults to `true` because we have typically always returned all matching crates, whether or not their versions have been yanked. This makes it possible to display only non-yanked crates at various places in the UI, and is especially intended for the user and team pages to display only non-yanked crates, as discussed in rust-lang#958.
Don't display crates that have been fully yanked - i.e., crates that where every version has been yanked - on user and team pages. Closes rust-lang#958
Don't display crates that have been fully yanked - i.e., crates that where every version has been yanked - on user and team pages. Closes rust-lang#958
…-pages, r=sgrif Exclude yanked crates on user/team pages Add a URL parameter to the `/api/v1/crates` endpoint that specifies whether or not the endpoint should return crates that have been fully yanked - i.e., where every version has been yanked. If not specified, this defaults to `true` because we have typically always returned all matching crates, whether or not their versions have been yanked. This makes it possible to display only non-yanked crates at various places in the UI without changing Rust code. Use this from the user and team pages to exclude yanked crates from them. Closes #958
…-pages, r=sgrif Exclude yanked crates on user/team pages Add a URL parameter to the `/api/v1/crates` endpoint that specifies whether or not the endpoint should return crates that have been fully yanked - i.e., where every version has been yanked. If not specified, this defaults to `true` because we have typically always returned all matching crates, whether or not their versions have been yanked. This makes it possible to display only non-yanked crates at various places in the UI without changing Rust code. Use this from the user and team pages to exclude yanked crates from them. Closes #958
…-pages, r=sgrif Exclude yanked crates on user/team pages Add a URL parameter to the `/api/v1/crates` endpoint that specifies whether or not the endpoint should return crates that have been fully yanked - i.e., where every version has been yanked. If not specified, this defaults to `true` because we have typically always returned all matching crates, whether or not their versions have been yanked. This makes it possible to display only non-yanked crates at various places in the UI without changing Rust code. Use this from the user and team pages to exclude yanked crates from them. Closes #958
…-pages, r=sgrif Exclude yanked crates on user/team pages Add a URL parameter to the `/api/v1/crates` endpoint that specifies whether or not the endpoint should return crates that have been fully yanked - i.e., where every version has been yanked. If not specified, this defaults to `true` because we have typically always returned all matching crates, whether or not their versions have been yanked. This makes it possible to display only non-yanked crates at various places in the UI without changing Rust code. Use this from the user and team pages to exclude yanked crates from them. Closes #958
Related to #145.
Since we currently only keep track of yanked-ness on version records rather than on crate records, implementing this involves:
yanked
equal tofalse
.The text was updated successfully, but these errors were encountered: