#245 require ban reason
This commit is contained in:
parent
4abddf3c64
commit
bfca7fdc2a
|
@ -23,6 +23,17 @@
|
|||
</a>
|
||||
<div v-else>
|
||||
<textarea v-model="user.bannedReason" class="form-control" rows="3" :placeholder="$t('ban.reason') + ' ' + $t('ban.visible')" :disabled="saving"></textarea>
|
||||
<div class="form-group">
|
||||
<p class="my-1"><label><strong><T>ban.terms</T>:</strong></label></p>
|
||||
<div style="columns: 3" class="small">
|
||||
<div class="form-check ps-0" v-for="term in forbidden">
|
||||
<label>
|
||||
<input type="checkbox" :value="term" v-model="user.bannedTerms"/>
|
||||
{{ term }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-danger d-block w-100 mt-2" :disabled="saving" @click="ban">
|
||||
<Icon v="ban"/>
|
||||
<T>ban.action</T>
|
||||
|
@ -34,6 +45,7 @@
|
|||
|
||||
<script>
|
||||
import ClientOnly from 'vue-client-only'
|
||||
import forbidden from "../src/forbidden";
|
||||
|
||||
export default {
|
||||
components: { ClientOnly },
|
||||
|
@ -49,6 +61,8 @@
|
|||
showBanForm: !!this.user.bannedReason,
|
||||
|
||||
saving: false,
|
||||
|
||||
forbidden,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -58,6 +72,7 @@
|
|||
try {
|
||||
await this.$post(`/admin/ban/${encodeURIComponent(this.user.username)}`, {
|
||||
reason: this.user.bannedReason,
|
||||
terms: this.user.bannedTerms,
|
||||
});
|
||||
window.location.reload();
|
||||
} finally {
|
||||
|
|
|
@ -91,9 +91,7 @@
|
|||
<blockquote class="small">
|
||||
It is forbidden to post on the Service any Content that might break the law or violate social norms,
|
||||
including but not limited to:
|
||||
propagation of totalitarian regimes, hate speech, racism, xenophobia, homophobia, transphobia, queerphobia,
|
||||
misogyny, harassment, impersonation, child pornography, unlawful conduct, misinformation,
|
||||
sharing of someone else's personal data, spam, advertisement, copyright or trademark violations.
|
||||
<template v-for="(term, i) in forbidden"><span :class="[$user().bannedTerms.includes(term) ? 'fw-bold' : '']">{{term}}</span><template v-if="i !== forbidden.length - 1">, </template></template>.
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -112,6 +110,7 @@
|
|||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import {DateTime} from "luxon";
|
||||
import forbidden from "../src/forbidden";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
@ -119,6 +118,7 @@
|
|||
hamburgerActive: false,
|
||||
hamburgerShown: false,
|
||||
censusDismissed: false,
|
||||
forbidden,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -537,6 +537,7 @@ mode:
|
|||
ban:
|
||||
reason: 'Grund der Sperrung'
|
||||
visible: '(dies wird der*m Nutzer*in sichtbar sein)'
|
||||
terms: 'Terms rules broken (required)' # TODO
|
||||
action: 'Diese Person sperren'
|
||||
confirm: 'Bist du sicher, die Person @%username% zu sperren?'
|
||||
header: 'Du wurdest gesperrt. Dein Profil kann nicht mehr angesehen werden.'
|
||||
|
|
|
@ -622,6 +622,7 @@ mode:
|
|||
ban:
|
||||
reason: 'Ban reason'
|
||||
visible: '(this will be visible to the user)'
|
||||
terms: 'Terms rules broken (required)'
|
||||
action: 'Ban this person'
|
||||
confirm: 'Are you sure you want to ban @%username%?'
|
||||
header: 'You''re banned. Your profile will not be shown to anyone.'
|
||||
|
|
|
@ -40,7 +40,7 @@ home:
|
|||
alt: 'También puedes introducir formas intercambiables por separado en cada campo, p. ej. <code>el&ella</code> = „el” o „ella”.'
|
||||
pronunciation: 'También puedes especificar la pronunciación de una entrada usando el AFI, p. ej. <code>ellx|ˈe.ʝe</code> = „ellx”, se pronuncia /ˈe.ʝe/.'
|
||||
whatisit: '¿Por qué importan los pronombres?'
|
||||
|
||||
|
||||
mission:
|
||||
header: 'Nuestra misión'
|
||||
summary: 'Luchamos por la libertad, el respeto y la inclusividad en la lengua.'
|
||||
|
@ -549,6 +549,7 @@ mode:
|
|||
ban:
|
||||
reason: 'Razón para banear'
|
||||
visible: '(esto será visible para le usuario)'
|
||||
terms: 'Terms rules broken (required)' # TODO
|
||||
action: 'Banear esta persona'
|
||||
confirm: '¿Estás segure que quieres banear a @%username%?'
|
||||
header: 'Has sido baneado. Tu perfil no se mostrará a nadie.'
|
||||
|
|
|
@ -542,6 +542,7 @@ mode:
|
|||
ban:
|
||||
reason: 'Raison du bannissement'
|
||||
visible: '(visible par l’utilisateur)'
|
||||
terms: 'Terms rules broken (required)' # TODO
|
||||
action: 'Bannir l’utilisateur'
|
||||
confirm: 'Voulez-vous bannir @%username%?'
|
||||
header: 'Vous êtes banni. Votre profil n’apparaîtra plus aux autres utilisateurs.'
|
||||
|
|
|
@ -534,6 +534,7 @@ mode:
|
|||
ban:
|
||||
reason: 'Ban reason'
|
||||
visible: '(this will be visible to the user)'
|
||||
terms: 'Terms rules broken (required)' # TODO
|
||||
action: 'Ban this person'
|
||||
confirm: 'Are you sure you want to ban @%username%?'
|
||||
header: 'You''re banned. Your profile will not be shown to anyone.'
|
||||
|
|
|
@ -23,8 +23,8 @@ home:
|
|||
Du ville vel ikke kalt Anne “Ingrid” bare fordi du liker det navnet bedre
|
||||
eller fordi du synes “hun ser ut som en Ingrid”?
|
||||
Selv dersom hun har navnet “Ingrid” i fødselsattesten hennes
|
||||
men hun hater det, og foretrekker å bruke “Anne” –
|
||||
så ville du kalt henne Anne. Det er likedan med pronomen.
|
||||
men hun hater det, og foretrekker å bruke “Anne” –
|
||||
så ville du kalt henne Anne. Det er likedan med pronomen.
|
||||
Hvis du ikke vil være frekk mot noen, kall de som de vil bli kalt..
|
||||
Den eneste forskjellen er at vi vanligvis vet navnet til en person, men ikke pronomen
|
||||
Vi introduserer oss selv med ett navn, men ikke med pronomen. La oss endre det!
|
||||
|
@ -52,7 +52,7 @@ home:
|
|||
– slik at <em>andres</em> pronomen er respektert.
|
||||
inclusiveness: >
|
||||
<strong>Inklusivitet</strong>
|
||||
– slik at når vi snakker om personer vi ikke kjenner,
|
||||
– slik at når vi snakker om personer vi ikke kjenner,
|
||||
antar vi ikke kjønnet deres, og ekskluderer dem ikke.
|
||||
|
||||
pronouns:
|
||||
|
@ -201,7 +201,7 @@ faq:
|
|||
{https://gender.wikia.org/wiki/Two-Spirit=(to åndelig)}, etc. etc.
|
||||
- >
|
||||
Intetkjønn eller ikke-binær er et begrep som beskriver identiteten til
|
||||
de som ikke passer inn i de binære mann/kvinne-båsene.
|
||||
de som ikke passer inn i de binære mann/kvinne-båsene.
|
||||
Det inkluderer folk som er
|
||||
{https://gender.wikia.org/wiki/Agender=akjønnet},
|
||||
{https://gender.wikia.org/wiki/Gender_Fluid=kjønnsflytende},
|
||||
|
@ -541,6 +541,7 @@ mode:
|
|||
ban:
|
||||
reason: 'Grunn til forbud'
|
||||
visible: '(dette vil kunne bli sett av brukeren)'
|
||||
terms: 'Terms rules broken (required)' # TODO
|
||||
action: 'Forby denne personen'
|
||||
confirm: 'Er du sikker på at du vil forby @%username%?'
|
||||
header: 'Du er forbydd. Profilen din vil ikke bli vist til noen.'
|
||||
|
|
|
@ -1160,6 +1160,7 @@ mode:
|
|||
ban:
|
||||
reason: 'Powód blokady'
|
||||
visible: '(to będzie widoczne dla osoby zbanowanej)'
|
||||
terms: 'Złamane punkty regulaminu (wymagane)'
|
||||
action: 'Zablokuj tę osobę'
|
||||
confirm: 'Czy na pewno chcesz zbanować @%username%?'
|
||||
header: 'Twoje konto jest zablokowane. Twoje profile nie są widoczne publicznie.'
|
||||
|
|
|
@ -548,6 +548,7 @@ mode:
|
|||
ban:
|
||||
reason: 'Razão de ban'
|
||||
visible: '(isso vai ser visto para usuárie)'
|
||||
terms: 'Terms rules broken (required)' # TODO
|
||||
action: 'Ban essa pessoa'
|
||||
confirm: 'Você está certe que quer banir @%username%?'
|
||||
header: 'Você está banido. Seu perfil não mais aparecerá em nosso site.'
|
||||
|
|
|
@ -1108,6 +1108,7 @@ mode:
|
|||
ban:
|
||||
reason: 'Ban reason'
|
||||
visible: '(this will be visible to the user)'
|
||||
terms: 'Terms rules broken (required)' # TODO
|
||||
action: 'Ban this person'
|
||||
confirm: 'Are you sure you want to ban @%username%?'
|
||||
header: 'You''re banned. Your profile will not be shown to anyone.'
|
||||
|
|
|
@ -552,6 +552,7 @@ mode:
|
|||
ban:
|
||||
reason: 'Ban reason'
|
||||
visible: '(this will be visible to the user)'
|
||||
terms: 'Terms rules broken (required)' # TODO
|
||||
action: 'Ban this person'
|
||||
confirm: 'Are you sure you want to ban @%username%?'
|
||||
header: 'You''re banned. Your profile will not be shown to anyone.'
|
||||
|
|
|
@ -518,6 +518,7 @@ mode:
|
|||
ban:
|
||||
reason: '封禁原因'
|
||||
visible: '(用戶可以看見這個)'
|
||||
terms: 'Terms rules broken (required)' # TODO
|
||||
action: '封禁用戶'
|
||||
confirm: '您確定要封禁@%username%嗎'
|
||||
header: '您被封禁了。你的資料不會對任何人顯示。'
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
-- Up
|
||||
|
||||
ALTER TABLE users ADD COLUMN bannedTerms TEXT NULL DEFAULT NULL;
|
||||
ALTER TABLE users ADD COLUMN bannedBy TEXT NULL DEFAULT NULL;
|
||||
|
||||
-- Down
|
||||
|
|
@ -47,9 +47,8 @@
|
|||
|
||||
<p>
|
||||
It is forbidden to post on the Service any Content that might break the law or violate social norms,
|
||||
including but not limited to: propagation of totalitarian regimes, hate speech, racism, xenophobia,
|
||||
homophobia, transphobia, queerphobia, misogyny, harassment, impersonation, child pornography, unlawful conduct, misinformation,
|
||||
sharing of someone else's personal data, spam, advertisement, copyright or trademark violations.
|
||||
including but not limited to:
|
||||
{{ forbidden.join(', ') }}.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@ -100,3 +99,15 @@
|
|||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import forbidden from "../src/forbidden";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
forbidden,
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -133,11 +133,24 @@ router.post('/admin/ban/:username', handleErrorAsync(async (req, res) => {
|
|||
return res.status(400).json({error: 'No such user'});
|
||||
}
|
||||
|
||||
await req.db.get(SQL`
|
||||
UPDATE users
|
||||
SET bannedReason = ${req.body.reason || null}
|
||||
WHERE id = ${user.id}
|
||||
`);
|
||||
if (req.body.reason) {
|
||||
if (!req.body.terms.length) {
|
||||
return res.status(400).json({error: 'Terms are required'});
|
||||
}
|
||||
await req.db.get(SQL`
|
||||
UPDATE users
|
||||
SET bannedReason = ${req.body.reason},
|
||||
bannedTerms = ${req.body.terms.join(',')},
|
||||
bannedBy = ${req.user.id}
|
||||
WHERE id = ${user.id}
|
||||
`);
|
||||
} else {
|
||||
await req.db.get(SQL`
|
||||
UPDATE users
|
||||
SET bannedReason = null
|
||||
WHERE id = ${user.id}
|
||||
`);
|
||||
}
|
||||
|
||||
await req.db.get(SQL`
|
||||
UPDATE reports
|
||||
|
|
|
@ -115,6 +115,7 @@ router.get('/profile/get/:username', handleErrorAsync(async (req, res) => {
|
|||
users.email,
|
||||
users.avatarSource,
|
||||
users.bannedReason,
|
||||
users.bannedTerms,
|
||||
users.roles != '' AS team
|
||||
FROM users
|
||||
WHERE users.usernameNorm = ${normalise(req.params.username)}
|
||||
|
@ -130,6 +131,8 @@ router.get('/profile/get/:username', handleErrorAsync(async (req, res) => {
|
|||
delete user.email;
|
||||
user.avatar = await avatar(req.db, user);
|
||||
|
||||
user.bannedTerms = user.bannedTerms ? user.bannedTerms.split(',') : [];
|
||||
|
||||
return res.json({
|
||||
...user,
|
||||
profiles: await fetchProfiles(req.db, req.params.username, isSelf),
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
export default [
|
||||
'propagation of totalitarian regimes',
|
||||
'hate speech',
|
||||
'racism',
|
||||
'xenophobia',
|
||||
'homophobia',
|
||||
'transphobia',
|
||||
'queerphobia',
|
||||
'misogyny',
|
||||
'harassment',
|
||||
'impersonation',
|
||||
'child pornography',
|
||||
'unlawful conduct',
|
||||
'misinformation',
|
||||
'sharing of someone else\'s personal data',
|
||||
'spam',
|
||||
'advertisement',
|
||||
'copyright or trademark violations',
|
||||
];
|
Reference in New Issue