mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-28 15:31:11 -04:00
(admin) faster profile moderation – introduce "mild sus"
keywords with a lot of false positives should only trigger when accompanied by at least one other keyword
This commit is contained in:
parent
8b024a917c
commit
a43c7c0ff6
@ -302,6 +302,14 @@ function* isSuspicious(profile) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mildSus = [
|
||||||
|
'fag',
|
||||||
|
'faggot',
|
||||||
|
'tranny',
|
||||||
|
'phobic',
|
||||||
|
'kys',
|
||||||
|
]
|
||||||
|
|
||||||
const hasAutomatedReports = async (db, id) => {
|
const hasAutomatedReports = async (db, id) => {
|
||||||
return (await db.get(SQL`SELECT COUNT(*) AS c FROM reports WHERE userId = ${id} AND isAutomatic = 1`)).c > 0;
|
return (await db.get(SQL`SELECT COUNT(*) AS c FROM reports WHERE userId = ${id} AND isAutomatic = 1`)).c > 0;
|
||||||
}
|
}
|
||||||
@ -696,7 +704,11 @@ router.post('/profile/save', handleErrorAsync(async (req, res) => {
|
|||||||
await req.db.get(SQL`INSERT INTO links (url) VALUES (${url}) ON CONFLICT (url) DO UPDATE SET expiresAt = null`);
|
await req.db.get(SQL`INSERT INTO links (url) VALUES (${url}) ON CONFLICT (url) DO UPDATE SET expiresAt = null`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const sus = [...isSuspicious(req.body)];
|
let sus = [...isSuspicious(req.body)];
|
||||||
|
// keywords with a lot of false positives should only trigger when accompanied by at least one other keyword
|
||||||
|
if (sus.length === 1 && mildSus.filter(k => sus[0].startsWith(k + ' (')).length > 0) {
|
||||||
|
sus = [];
|
||||||
|
}
|
||||||
if (sus.length && !await hasAutomatedReports(req.db, req.user.id)) {
|
if (sus.length && !await hasAutomatedReports(req.db, req.user.id)) {
|
||||||
await req.db.get(SQL`
|
await req.db.get(SQL`
|
||||||
INSERT INTO reports (id, userId, reporterId, isAutomatic, comment, isHandled, snapshot)
|
INSERT INTO reports (id, userId, reporterId, isAutomatic, comment, isHandled, snapshot)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user