From 74678f4fed20cbb9ba8730eeec002c7baff42138 Mon Sep 17 00:00:00 2001 From: Emma Alexia Date: Mon, 17 Mar 2025 20:05:56 -0400 Subject: [PATCH] Hide collections with no projects from public view --- 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 d347f70acb..34a6129688 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 0d6a0c3128..3e03fd9bee 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,