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

@@ -387,6 +387,16 @@ pub async fn project_edit(
)
.execute(&mut *transaction)
.await?;
crate::util::report::censor_check(
&*title,
Some(project_item.inner.id),
None,
None,
"Project edited with inappropriate title".to_string(),
&mut transaction,
)
.await?;
}
if let Some(description) = &new_project.description {
@@ -408,6 +418,16 @@ pub async fn project_edit(
)
.execute(&mut *transaction)
.await?;
crate::util::report::censor_check(
&*description,
Some(project_item.inner.id),
None,
None,
"Project edited with inappropriate description".to_string(),
&mut transaction,
)
.await?;
}
if let Some(status) = &new_project.status {
@@ -679,6 +699,16 @@ pub async fn project_edit(
));
}
}
crate::util::report::censor_check(
&*slug,
Some(project_item.inner.id),
None,
None,
"Project edited with inappropriate slug".to_string(),
&mut transaction,
)
.await?;
}
sqlx::query!(
@@ -891,6 +921,16 @@ pub async fn project_edit(
)
.execute(&mut *transaction)
.await?;
crate::util::report::censor_check(
&*body,
Some(project_item.inner.id),
None,
None,
"Project edited with inappropriate body".to_string(),
&mut transaction,
)
.await?;
}
transaction.commit().await?;