You've already forked AstralRinth
forked from didirus/AstralRinth
feat(labrinth): rework v3 side types to a single environment field (#3701)
* feat(labrinth): rework v3 side types to a single `environment` field This field is meant to be able to represent the existing v2 side type information and beyond, in a way that may also be slightly easier to comprehend. * chore(labrinth/migrations): use proper val for `HAVING` clause * feat(labrinth): add `side_types_migration_review_status` field to projects
This commit is contained in:
committed by
GitHub
parent
65126b3a23
commit
ef04dcc37b
@@ -17,6 +17,7 @@ use crate::models::notifications::NotificationBody;
|
||||
use crate::models::pats::Scopes;
|
||||
use crate::models::projects::{
|
||||
MonetizationStatus, Project, ProjectStatus, SearchRequest,
|
||||
SideTypesMigrationReviewStatus,
|
||||
};
|
||||
use crate::models::teams::ProjectPermissions;
|
||||
use crate::models::threads::MessageBody;
|
||||
@@ -247,6 +248,8 @@ pub struct EditProject {
|
||||
#[validate(length(max = 65536))]
|
||||
pub moderation_message_body: Option<Option<String>>,
|
||||
pub monetization_status: Option<MonetizationStatus>,
|
||||
pub side_types_migration_review_status:
|
||||
Option<SideTypesMigrationReviewStatus>,
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
@@ -844,6 +847,29 @@ pub async fn project_edit(
|
||||
.await?;
|
||||
}
|
||||
|
||||
if let Some(side_types_migration_review_status) =
|
||||
&new_project.side_types_migration_review_status
|
||||
{
|
||||
if !perms.contains(ProjectPermissions::EDIT_DETAILS) {
|
||||
return Err(ApiError::CustomAuthentication(
|
||||
"You do not have the permissions to edit the side types migration review status of this project!"
|
||||
.to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
sqlx::query!(
|
||||
"
|
||||
UPDATE mods
|
||||
SET side_types_migration_review_status = $1
|
||||
WHERE id = $2
|
||||
",
|
||||
side_types_migration_review_status.as_str(),
|
||||
id as db_ids::DBProjectId,
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
}
|
||||
|
||||
// check new description and body for links to associated images
|
||||
// if they no longer exist in the description or body, delete them
|
||||
let checkable_strings: Vec<&str> =
|
||||
|
||||
Reference in New Issue
Block a user