diff --git a/src/routes/projects.rs b/src/routes/projects.rs index c6654fcef..ab8a67b9d 100644 --- a/src/routes/projects.rs +++ b/src/routes/projects.rs @@ -457,6 +457,18 @@ pub async fn project_edit( )); } + if !user.role.is_mod() + && !(!project_item.inner.status.is_approved() + && status == &ProjectStatus::Processing + || project_item.inner.status.is_approved() + && status.can_be_requested()) + { + return Err(ApiError::CustomAuthentication( + "You don't have permission to set this status!" + .to_string(), + )); + } + if status == &ProjectStatus::Processing { if project_item.versions.is_empty() { return Err(ApiError::InvalidInput(String::from( @@ -499,15 +511,6 @@ pub async fn project_edit( } } - if (status.is_approved() || !status.can_be_requested()) - && !user.role.is_mod() - { - return Err(ApiError::CustomAuthentication( - "You don't have permission to set this status!" - .to_string(), - )); - } - if status.is_approved() && !project_item.inner.status.is_approved() {