From 72cfa683cfdb3027488237999d55186231db31d3 Mon Sep 17 00:00:00 2001 From: Geometrically <18202329+Geometrically@users.noreply.github.com> Date: Fri, 21 Apr 2023 13:55:50 -0700 Subject: [PATCH] Fix edit bug staging (#582) * Fix edit bug staging * Fix comp err * Fix mod message bug * Fix compile bug * Run fmt * Fix other bug --- src/routes/v2/projects.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/routes/v2/projects.rs b/src/routes/v2/projects.rs index 65b58ccb..2ec19395 100644 --- a/src/routes/v2/projects.rs +++ b/src/routes/v2/projects.rs @@ -1052,7 +1052,9 @@ pub async fn project_edit( } if let Some(moderation_message) = &new_project.moderation_message { - if !user.role.is_mod() && project_item.inner.status != ProjectStatus::Approved { + if !user.role.is_mod() + && (!project_item.inner.status.is_approved() || moderation_message != &None) + { return Err(ApiError::CustomAuthentication( "You do not have the permissions to edit the moderation message of this project!" .to_string(), @@ -1073,7 +1075,10 @@ pub async fn project_edit( } if let Some(moderation_message_body) = &new_project.moderation_message_body { - if !user.role.is_mod() && project_item.inner.status != ProjectStatus::Approved { + if !user.role.is_mod() + && (!project_item.inner.status.is_approved() + || moderation_message_body != &None) + { return Err(ApiError::CustomAuthentication( "You do not have the permissions to edit the moderation message body of this project!" .to_string(), @@ -1268,7 +1273,7 @@ pub async fn projects_edit( if !user.role.is_mod() { if let Some(member) = team_members .iter() - .find(|x| x.team_id == project.inner.team_id) + .find(|x| x.team_id == project.inner.team_id && x.user.id == user.id.into()) { if !member.permissions.contains(Permissions::EDIT_DETAILS) { return Err(ApiError::CustomAuthentication(format!(