Remove sexually explicit typos rule and add migration for masked call participants

This commit is contained in:
2025-08-23 13:22:35 -03:00
parent 7d47a9eb35
commit 6c72c27911
7 changed files with 6 additions and 46 deletions
Generated
+1 -1
View File
@@ -1437,7 +1437,7 @@ checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
[[package]] [[package]]
name = "payphone" name = "payphone"
version = "4.2.15" version = "4.2.17"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"axum", "axum",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "payphone" name = "payphone"
version = "4.2.15" version = "4.2.17"
edition = "2024" edition = "2024"
default-run = "payphone" default-run = "payphone"
@@ -3,4 +3,4 @@ ALTER TABLE payphone.participants ADD is_masked BOOLEAN;
CREATE MATERIALIZED VIEW IF NOT EXISTS payphone.participants_by_user_id AS CREATE MATERIALIZED VIEW IF NOT EXISTS payphone.participants_by_user_id AS
SELECT user_id, call_id, channel_id FROM payphone.participants SELECT user_id, call_id, channel_id FROM payphone.participants
WHERE user_id IS NOT NULL AND call_id IS NOT NULL AND channel_id IS NOT NULL WHERE user_id IS NOT NULL AND call_id IS NOT NULL AND channel_id IS NOT NULL
PRIMARY KEY (user_id, call_id); PRIMARY KEY (user_id, call_id, channel_id);
@@ -13,3 +13,5 @@ gtfo
keys keys
// Many people not knowing paki is a slur, it's better to keep it here. // Many people not knowing paki is a slur, it's better to keep it here.
paki paki
hoe
ho
@@ -1 +0,0 @@
ho
@@ -56,9 +56,6 @@ gang bang
squirt squirt
squirting squirting
squirts squirts
hoe
// ho is in "explicit sexual language typos" because it's usually also a typo of "hi". it gets
// censored instead of banned.
slut slut
dldo dldo
dildo dildo
-38
View File
@@ -559,43 +559,6 @@ impl Rule for ExplicitSexualLanguageRule {
} }
} }
#[derive(Debug)]
struct ExplicitSexualLanguageTypoRule {
pattern: Regex,
exceptions: Vec<String>,
}
impl ExplicitSexualLanguageTypoRule {
fn new() -> Self {
let (phrases, exceptions) =
parse_phrases_file(include_str!("lists/explicit-sexual-language-typos.txt"));
let regex = regex_from_phrases_list(&phrases);
Self {
pattern: regex,
exceptions,
}
}
}
impl Rule for ExplicitSexualLanguageTypoRule {
fn action(&self) -> &'static Action {
&Action::SoftCensorAndWarn
}
fn name(&self) -> &'static str {
"Explicit Sexual Language Typo"
}
fn detect(&self, _original: &str, normalized: &str) -> (Vec<String>, Vec<String>) {
(
vec![],
find_with_exceptions(normalized, &self.pattern, &self.exceptions),
)
}
}
#[derive(Debug)] #[derive(Debug)]
struct SuggestiveLanguageRule { struct SuggestiveLanguageRule {
pattern: Regex, pattern: Regex,
@@ -805,7 +768,6 @@ pub static RULES: Lazy<Vec<Arc<dyn Rule>>> = Lazy::new(|| {
Arc::new(HateSpeechAndSlursRule::new()), Arc::new(HateSpeechAndSlursRule::new()),
Arc::new(ThreatsAndSelfHarmRule::new()), Arc::new(ThreatsAndSelfHarmRule::new()),
Arc::new(ExplicitSexualLanguageRule::new()), Arc::new(ExplicitSexualLanguageRule::new()),
Arc::new(ExplicitSexualLanguageTypoRule::new()),
Arc::new(SuggestiveLanguageRule::new()), Arc::new(SuggestiveLanguageRule::new()),
Arc::new(AdvertisingRule), Arc::new(AdvertisingRule),
Arc::new(SensitiveTopicsAndTriggeringContentRule::new()), Arc::new(SensitiveTopicsAndTriggeringContentRule::new()),