Hide collections with no projects from public view (#3408)

Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
Emma Alexia 2025-04-06 16:54:18 -04:00 committed by GitHub
parent 36367e475e
commit 365367dd16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -328,7 +328,8 @@ pub async fn is_visible_collection(
collection_data: &Collection,
user_option: &Option<User>,
) -> Result<bool, ApiError> {
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())

View File

@ -50,7 +50,7 @@ pub struct CollectionCreateData {
#[validate(length(min = 3, max = 255))]
/// A short description of the collection.
pub description: Option<String>,
#[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<String>,