You've already forked AstralRinth
forked from didirus/AstralRinth
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:
@@ -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?;
|
||||
|
||||
Reference in New Issue
Block a user