#303 easier moderation - direct link to locale

This commit is contained in:
Andrea 2022-04-06 18:10:57 +02:00
parent be9761619b
commit 51995c4019
2 changed files with 12 additions and 5 deletions

View File

@ -18,11 +18,16 @@
<template v-slot:row="s"><template v-if="s && s.el.susUsername">
<td>
<a :href="`https://pronouns.page/@${s.el.susUsername}`" target="_blank" rel="noopener">@{{s.el.susUsername}}</a>
<ul v-if="s.el.profiles" class="small list-inline">
<li v-for="locale in s.el.profiles.split(',')" class="list-inline-item mt-2">
<LocaleLink :locale="locale" :link="`/@${s.el.susUsername}`">{{ locales[locale].name }}</LocaleLink>
</li>
</ul>
</td>
<td>
<span v-if="s.el.isAutomatic" class="badge bg-info">
Keyword found
</span>
<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>
<small>({{$datetime($ulidTime(s.el.id))}})</small>
</td>

View File

@ -189,11 +189,13 @@ router.get('/admin/reports', handleErrorAsync(async (req, res) => {
}
return res.json(await req.db.all(SQL`
SELECT reports.id, sus.username AS susUsername, reporter.username AS reporterUsername, reports.comment, reports.isAutomatic, reports.isHandled
SELECT reports.id, group_concat(p.locale) as profiles, sus.username AS susUsername, reporter.username AS reporterUsername, reports.comment, reports.isAutomatic, reports.isHandled
FROM reports
LEFT JOIN users sus ON reports.userId = sus.id
LEFT JOIN users reporter ON reports.reporterId = reporter.id
ORDER BY reports.isHandled ASC, reports.id DESC
LEFT JOIN profiles p on sus.id = p.userId
GROUP BY reports.id
ORDER BY min(reports.isHandled) ASC, reports.id DESC
`));
}));