Add auto-reporting inappropriate text content (#387)

* Add initial support for blocking inappropriate text content

To make something clear, **nothing** is automatically censored or
deleted as a result of this pull request. This pull request is
meant to add two things:
- Regenerate new IDs (project, version, user, etc.) with profanity
- Send reports to the moderators for new inappropriate content

* Make it build

* Fix logic issue

Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
This commit is contained in:
Emma Cypress ⚘
2022-07-10 01:51:55 +00:00
committed by GitHub
parent 18d1bc56fd
commit 68f7dc9512
10 changed files with 216 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
use super::ApiError;
use crate::database;
use crate::database::models::VersionId;
use crate::models;
use crate::models::projects::{Dependency, Version};
use crate::models::teams::Permissions;
@@ -247,6 +248,16 @@ pub async fn version_edit(
)
.execute(&mut *transaction)
.await?;
crate::util::report::censor_check(
&*name,
None,
Some(VersionId::from(version_id)),
None,
"Version edited with inappropriate name".to_string(),
&mut transaction,
)
.await?;
}
if let Some(number) = &new_version.version_number {
@@ -463,6 +474,16 @@ pub async fn version_edit(
)
.execute(&mut *transaction)
.await?;
crate::util::report::censor_check(
&*body,
None,
Some(VersionId::from(version_id)),
None,
"Version edited with inappropriate changelog".to_string(),
&mut transaction,
)
.await?;
}
if let Some(downloads) = &new_version.downloads {