[profiles][ban] save profile snapshots for reports and bans

This commit is contained in:
Andrea 2021-12-18 22:42:06 +01:00
parent 3e17e485e9
commit c2ab86e80f
1 changed files with 2 additions and 2 deletions

View File

@ -263,8 +263,8 @@ router.post('/profile/save', handleErrorAsync(async (req, res) => {
const sus = [...isSuspicious(req.body)]; const sus = [...isSuspicious(req.body)];
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) INSERT INTO reports (id, userId, reporterId, isAutomatic, comment, isHandled, snapshot)
VALUES (${ulid()}, ${req.user.id}, null, 1, ${sus.join(', ')}, 0); VALUES (${ulid()}, ${req.user.id}, null, 1, ${sus.join(', ')}, 0, ${await profilesSnapshot(req.db, normalise(req.params.username))});
`); `);
} }