Skip to content

Commit 365367d

Browse files
triphoraProspector
andauthored
Hide collections with no projects from public view (#3408)
Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
1 parent 36367e4 commit 365367d

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

apps/labrinth/src/auth/checks.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ pub async fn is_visible_collection(
328328
collection_data: &Collection,
329329
user_option: &Option<User>,
330330
) -> Result<bool, ApiError> {
331-
let mut authorized = !collection_data.status.is_hidden();
331+
let mut authorized = !collection_data.status.is_hidden()
332+
&& !collection_data.projects.is_empty();
332333
if let Some(user) = &user_option {
333334
if !authorized
334335
&& (user.role.is_mod() || user.id == collection_data.user_id.into())

apps/labrinth/src/routes/v3/collections.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub struct CollectionCreateData {
5050
#[validate(length(min = 3, max = 255))]
5151
/// A short description of the collection.
5252
pub description: Option<String>,
53-
#[validate(length(max = 32))]
53+
#[validate(length(max = 1024))]
5454
#[serde(default = "Vec::new")]
5555
/// A list of initial projects to use with the created collection
5656
pub projects: Vec<String>,

0 commit comments

Comments
 (0)