Hide collections with no projects from public view (#3408)
Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
parent
36367e475e
commit
365367dd16
@ -328,7 +328,8 @@ pub async fn is_visible_collection(
|
|||||||
collection_data: &Collection,
|
collection_data: &Collection,
|
||||||
user_option: &Option<User>,
|
user_option: &Option<User>,
|
||||||
) -> Result<bool, ApiError> {
|
) -> 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 let Some(user) = &user_option {
|
||||||
if !authorized
|
if !authorized
|
||||||
&& (user.role.is_mod() || user.id == collection_data.user_id.into())
|
&& (user.role.is_mod() || user.id == collection_data.user_id.into())
|
||||||
|
|||||||
@ -50,7 +50,7 @@ pub struct CollectionCreateData {
|
|||||||
#[validate(length(min = 3, max = 255))]
|
#[validate(length(min = 3, max = 255))]
|
||||||
/// A short description of the collection.
|
/// A short description of the collection.
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
#[validate(length(max = 32))]
|
#[validate(length(max = 1024))]
|
||||||
#[serde(default = "Vec::new")]
|
#[serde(default = "Vec::new")]
|
||||||
/// A list of initial projects to use with the created collection
|
/// A list of initial projects to use with the created collection
|
||||||
pub projects: Vec<String>,
|
pub projects: Vec<String>,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user