#229 notify about abuse reports
This commit is contained in:
parent
c45a8c0bf6
commit
03198f9107
|
@ -705,7 +705,7 @@ links:
|
|||
To nie jest pocisk, jaki myślicie że jest.
|
||||
- >
|
||||
Nie „autorszcza”, a „autorza”. Można sprawdzić, jakich form używamy:
|
||||
słownik, który krytykujecie jest {/slowniki/neutratywy#autor=na wyciągnięcie ręki}!
|
||||
słownik, który krytykujecie, jest {/slowniki/neutratywy#autor=na wyciągnięcie ręki}!
|
||||
- >
|
||||
W skrócie: krótki akapit zajawkowy jest naszpikowany manipulacją, sugeruje jakobyśmy nienawidziły polszczyzny,
|
||||
wkłada słowa w nasze usta i demonstruje brak riserczu na temat, na który piszecie.
|
||||
|
|
|
@ -113,13 +113,13 @@
|
|||
|
||||
<template v-slot:row="s"><template v-if="s">
|
||||
<td>
|
||||
<a :href="`https://pronouns.page/${s.el.susUsername}`" target="_blank" rel="noopener">@{{s.el.susUsername}}</a>
|
||||
<a :href="`https://pronouns.page/@${s.el.susUsername}`" target="_blank" rel="noopener">@{{s.el.susUsername}}</a>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="s.el.isAutomatic" class="badge bg-info">
|
||||
Keyword found
|
||||
</span>
|
||||
<a v-else :href="`https://pronouns.page/${s.el.reporterUsername}`" target="_blank" rel="noopener">@{{s.el.reporterUsername}}</a>
|
||||
<a v-else :href="`https://pronouns.page/@${s.el.reporterUsername}`" target="_blank" rel="noopener">@{{s.el.reporterUsername}}</a>
|
||||
<small>({{$datetime($ulidTime(s.el.id))}})</small>
|
||||
</td>
|
||||
<td class="small">
|
||||
|
|
|
@ -13,7 +13,7 @@ const isGranted = (user, locale, area) => {
|
|||
return true;
|
||||
}
|
||||
const [ permissionLocale, permissionArea ] = permission.split('-');
|
||||
if ((permissionLocale === '*' || permissionLocale === locale) && (permissionArea === '*' || permissionArea === area)) {
|
||||
if ((permissionLocale === '*' || permissionLocale === locale || locale === null) && (permissionArea === '*' || permissionArea === area)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ async function notify() {
|
|||
...(await db.all(`SELECT 'nouns' as type, locale, count(*) as c FROM nouns WHERE approved = 0 AND deleted=0 GROUP BY locale`)),
|
||||
...(await db.all(`SELECT 'inclusive' as type, locale, count(*) as c FROM inclusive WHERE approved = 0 AND deleted=0 GROUP BY locale`)),
|
||||
...(await db.all(`SELECT 'sources' as type, locale, count(*) as c FROM sources WHERE approved = 0 AND deleted=0 GROUP BY locale`)),
|
||||
...(await db.all(`SELECT 'reports' as type, null as locale, count(*) as c FROM reports WHERE isHandled = 0`)),
|
||||
];
|
||||
if (!awaitingModeration.length) {
|
||||
console.log('No entries awaiting moderation');
|
||||
|
@ -44,7 +45,7 @@ async function notify() {
|
|||
if (awaitingModerationGrouped[admin.email] === undefined) {
|
||||
awaitingModerationGrouped[admin.email] = {};
|
||||
}
|
||||
awaitingModerationGrouped[admin.email][m.locale + '-' + m.type] = m.c;
|
||||
awaitingModerationGrouped[admin.email][(m.locale || '*') + '-' + m.type] = m.c;
|
||||
}
|
||||
}
|
||||
count += m.c;
|
||||
|
|
|
@ -130,10 +130,21 @@ router.post('/admin/ban/:username', handleErrorAsync(async (req, res) => {
|
|||
return res.status(401).json({error: 'Unauthorised'});
|
||||
}
|
||||
|
||||
const user = await req.db.get(SQL`SELECT id FROM users WHERE usernameNorm = ${normalise(req.params.username)}`);
|
||||
if (!user) {
|
||||
return res.status(400).json({error: 'No such user'});
|
||||
}
|
||||
|
||||
await req.db.get(SQL`
|
||||
UPDATE users
|
||||
SET bannedReason = ${req.body.reason || null}
|
||||
WHERE usernameNorm = ${normalise(req.params.username)}
|
||||
WHERE id = ${user.id}
|
||||
`);
|
||||
|
||||
await req.db.get(SQL`
|
||||
UPDATE reports
|
||||
SET isHandled = 1
|
||||
WHERE userId = ${user.id}
|
||||
`);
|
||||
|
||||
return res.json(true);
|
||||
|
|
Reference in New Issue