From 365367dd16f0ca37f9d43f52af020c4dc99b374b Mon Sep 17 00:00:00 2001 From: Emma Alexia Date: Sun, 6 Apr 2025 16:54:18 -0400 Subject: [PATCH] Hide collections with no projects from public view (#3408) Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com> --- apps/labrinth/src/auth/checks.rs | 3 ++- apps/labrinth/src/routes/v3/collections.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/labrinth/src/auth/checks.rs b/apps/labrinth/src/auth/checks.rs index d347f70ac..34a612968 100644 --- a/apps/labrinth/src/auth/checks.rs +++ b/apps/labrinth/src/auth/checks.rs @@ -328,7 +328,8 @@ pub async fn is_visible_collection( collection_data: &Collection, user_option: &Option, ) -> Result { - let mut authorized = !collection_data.status.is_hidden(); + let mut authorized = !collection_data.status.is_hidden() + && !collection_data.projects.is_empty(); if let Some(user) = &user_option { if !authorized && (user.role.is_mod() || user.id == collection_data.user_id.into()) diff --git a/apps/labrinth/src/routes/v3/collections.rs b/apps/labrinth/src/routes/v3/collections.rs index 0d6a0c312..3e03fd9be 100644 --- a/apps/labrinth/src/routes/v3/collections.rs +++ b/apps/labrinth/src/routes/v3/collections.rs @@ -50,7 +50,7 @@ pub struct CollectionCreateData { #[validate(length(min = 3, max = 255))] /// A short description of the collection. pub description: Option, - #[validate(length(max = 32))] + #[validate(length(max = 1024))] #[serde(default = "Vec::new")] /// A list of initial projects to use with the created collection pub projects: Vec,