Skip to content

Commit

Permalink
Fix statuses again (#497)
Browse files Browse the repository at this point in the history
* Fix statuses again

* Make it compile
  • Loading branch information
Geometrically authored Dec 9, 2022
1 parent a5f9331 commit 30b29de
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/routes/projects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()
{
Expand Down

0 comments on commit 30b29de

Please sign in to comment.