Merge pull request 'Fix/mute log wording' (#147) from fix/mute-log-wording into main
CI / quality (push) Has been cancelled
CI / quality (push) Has been cancelled
Reviewed-on: #147
This commit was merged in pull request #147.
This commit is contained in:
commit
20ffbbacad
11 files changed
+97
-42
No files matched your search
@@ -1,12 +1,12 @@
|
|||||||
# AGENTS.md — Instructions pour les agents IA
|
# AGENTS.md — Instructions pour les agents IA
|
||||||
|
|
||||||
> Fichier de référence pour les agents IA (Codebuff, Cursor, Claude Code, GitHub Copilot…) qui travaillent sur un repo de l'organisation **FWS**. Un agent doit lire ce fichier en premier : il contient les instructions à respecter. Le `README.md` apporte le contexte complet.
|
> Fichier de référence pour les agents IA (Codebuff, Cursor, Claude Code, GitHub Copilot…) qui travaillent sur un dépôt de l'organisation **FWS**. Un agent doit lire ce fichier en premier : il contient les instructions à respecter. Le `README.md` présente l'organisation et le `CONTRIBUTING.md` détaille les conventions de collaboration.
|
||||||
|
|
||||||
## Contexte
|
## Contexte
|
||||||
|
|
||||||
- **FWS** est une organisation open source multi-projets : chaque projet choisit librement sa stack (pas de restriction de langage).
|
- **FWS** est une organisation open source multi-projets : chaque projet choisit librement sa stack technique (sans restriction de langage).
|
||||||
- Projet principal : **FWS Arch** — un fork d'Arch Linux avec une surcouche conviviale pour simplifier l'installation et l'usage au quotidien.
|
- Projet principal : **FWS ISO** — une distribution Linux basée sur Arch Linux, pensée pour simplifier l'installation et l'usage au quotidien.
|
||||||
- Conventions détaillées : `README.md` (FR) / `README.en.md` (EN).
|
- Conventions détaillées : `CONTRIBUTING.md` (FR) / `CONTRIBUTING.en.md` (EN).
|
||||||
|
|
||||||
## Règles à respecter
|
## Règles à respecter
|
||||||
|
|
||||||
@@ -24,29 +24,36 @@
|
|||||||
|
|
||||||
### Code & commentaires
|
### Code & commentaires
|
||||||
|
|
||||||
- Commentaires en **anglais**, style « pourquoi » : pas de commentaire si le code est explicite, documenter le non-évident (choix d'implémentation, trade-offs, cas limites).
|
- Commentaires en **anglais**, style « pourquoi » : pas de commentaire si le code est explicite ; documenter le non-évident (choix d'implémentation, compromis, cas limites).
|
||||||
- Respecter la stack et les conventions existantes du repo avant d'ajouter de nouvelles dépendances.
|
- Respecter la stack technique et les conventions existantes du dépôt avant d'ajouter de nouvelles dépendances.
|
||||||
|
|
||||||
### Fichiers sensibles (`.gitignore`)
|
### Fichiers sensibles (`.gitignore`)
|
||||||
|
|
||||||
- Ne **jamais** committer : fichiers d'environnement (`.env*`), données d'assistants de développement (`.freebuff/`), artefacts compilés (`dist/`, `build/`, `target/`, `__pycache__/`…), dépendances (`node_modules/`), secrets.
|
- Ne **jamais** versionner : fichiers d'environnement (`.env*`), données d'assistants de développement (`.freebuff/`), artefacts compilés (`dist/`, `build/`, `target/`, `__pycache__/`…), dépendances (`node_modules/`), secrets.
|
||||||
- Un `.gitignore` doit exister à la racine de chaque repo.
|
- Un `.gitignore` doit exister à la racine de chaque dépôt.
|
||||||
|
|
||||||
### Tests
|
### Tests
|
||||||
|
|
||||||
- Fichiers de test : `*.test.*`, noms `describe` / `it` en anglais.
|
- Fichiers de test : `*.test.*` ; noms de tests `describe` / `it` en anglais.
|
||||||
- Vérifier que les tests (et le typecheck / lint quand ils existent) passent avant de considérer une tâche terminée.
|
- Vérifier que les tests (et le typecheck / lint quand ils existent) passent avant de considérer une tâche terminée.
|
||||||
|
|
||||||
### Issues & signalement de bugs
|
### Issues & signalement de bugs
|
||||||
|
|
||||||
- Les bugs et demandes sont suivis via les **issues**, liées au tableau Kanban.
|
- Les bugs et demandes sont suivis via les **issues** et, lorsqu'il existe, le tableau Kanban du projet.
|
||||||
- Une PR qui corrige un bug référence l'issue dans son titre ou sa description (`Fixes #123`).
|
- Une pull request qui corrige un bug référence l'issue dans son titre ou sa description (`Fixes #123`).
|
||||||
- Ne pas fermer ni modifier une issue sans demande explicite de l'utilisateur.
|
- Ne pas fermer ni modifier une issue sans demande explicite de l'utilisateur.
|
||||||
|
|
||||||
|
### Commits demandés par l'utilisateur
|
||||||
|
|
||||||
|
- Lorsque l'utilisateur demande explicitement de créer un commit, l'IA doit le faire après avoir vérifié les changements et les contrôles disponibles, sans attendre une confirmation supplémentaire.
|
||||||
|
- Le titre et le corps du commit ne doivent jamais mentionner l'IA, l'assistant, Codebuff ou l'outil utilisé.
|
||||||
|
- Ne pas ajouter l'IA comme auteur ou co-auteur dans le message du commit.
|
||||||
|
|
||||||
## Bonnes pratiques pour un agent
|
## Bonnes pratiques pour un agent
|
||||||
|
|
||||||
- Lire `AGENTS.md` puis `README.md` avant d'éditer du code.
|
- Lire `AGENTS.md`, le `README.md` et le `CONTRIBUTING.md` avant d'éditer du code.
|
||||||
|
- Les commits doivent être signés.
|
||||||
- Faire les changements les plus petits possibles qui répondent à la demande.
|
- Faire les changements les plus petits possibles qui répondent à la demande.
|
||||||
- Ne pas pousser, merger ni publier sans demande explicite de l'utilisateur.
|
- Ne pas pousser, fusionner ni publier sans demande explicite de l'utilisateur.
|
||||||
- Suivre les cartes du tableau Kanban du projet pour l'organisation du travail.
|
- Suivre les cartes du tableau Kanban lorsqu'il existe pour organiser le travail.
|
||||||
- En cas de doute, demander plutôt que deviner.
|
- En cas de doute, demander plutôt que de deviner.
|
||||||
@@ -92,6 +92,7 @@ The project follows [Semantic Versioning](https://semver.org/).
|
|||||||
- **config:** _(feat)_ load and expose environment settings ([d1388b6])
|
- **config:** _(feat)_ load and expose environment settings ([d1388b6])
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
- **moderation:** _(fix)_ tell a mute apart from a kick in the logs ([99e1fd2])
|
||||||
- **wiki:** _(fix)_ render the public pages on the server ([8869c74])
|
- **wiki:** _(fix)_ render the public pages on the server ([8869c74])
|
||||||
- **web:** _(fix)_ stop caching the interface modules ([3f4a570])
|
- **web:** _(fix)_ stop caching the interface modules ([3f4a570])
|
||||||
- **web:** _(fix)_ keep the stack when a view fails ([c031b4d])
|
- **web:** _(fix)_ keep the stack when a view fails ([c031b4d])
|
||||||
@@ -110,6 +111,7 @@ The project follows [Semantic Versioning](https://semver.org/).
|
|||||||
- **notifications:** _(fix)_ apply the channel overrides set from Discord ([92405ac])
|
- **notifications:** _(fix)_ apply the channel overrides set from Discord ([92405ac])
|
||||||
|
|
||||||
### Other changes
|
### Other changes
|
||||||
|
- **agents:** _(docs)_ update the repository conventions and commit rules ([44e990d])
|
||||||
- **web:** _(docs)_ document my tasks, the search and the status page ([566af4d])
|
- **web:** _(docs)_ document my tasks, the search and the status page ([566af4d])
|
||||||
- **web:** _(refactor)_ extract the build marker into its own module ([d2256e2])
|
- **web:** _(refactor)_ extract the build marker into its own module ([d2256e2])
|
||||||
- **ops:** _(docs)_ correct the deployment path for a panel without a shell ([e3ce266])
|
- **ops:** _(docs)_ correct the deployment path for a panel without a shell ([e3ce266])
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { MessageFlags, PermissionFlagsBits, SlashCommandBuilder } from 'discord.js';
|
import { MessageFlags, PermissionFlagsBits, SlashCommandBuilder } from 'discord.js';
|
||||||
import { ACCESS_LEVELS, COLORS, MODERATION_ACTIONS } from '../../config/constants.js';
|
import { ACCESS_LEVELS, COLORS } from '../../config/constants.js';
|
||||||
import { listActions } from '../../database/repositories/moderation-repository.js';
|
import { listActions } from '../../database/repositories/moderation-repository.js';
|
||||||
import { formatDuration } from '../../services/moderation/moderation-service.js';
|
import { formatDuration, moderationLabel } from '../../services/moderation/moderation-service.js';
|
||||||
import { baseEmbed, infoEmbed } from '../../ui/embeds.js';
|
import { baseEmbed, infoEmbed } from '../../ui/embeds.js';
|
||||||
|
|
||||||
export const access = ACCESS_LEVELS.STAFF;
|
export const access = ACCESS_LEVELS.STAFF;
|
||||||
@@ -20,11 +20,10 @@ export const data = new SlashCommandBuilder()
|
|||||||
);
|
);
|
||||||
|
|
||||||
function formatEntry(row) {
|
function formatEntry(row) {
|
||||||
const meta = MODERATION_ACTIONS[row.action];
|
|
||||||
const target = row.target_id ? `<@${row.target_id}>` : 'salon';
|
const target = row.target_id ? `<@${row.target_id}>` : 'salon';
|
||||||
const duration = row.duration_ms ? ` pendant ${formatDuration(row.duration_ms)}` : '';
|
const duration = row.duration_ms ? ` pendant ${formatDuration(row.duration_ms)}` : '';
|
||||||
return (
|
return (
|
||||||
`\`${row.created_at}\` **${meta?.label ?? row.action}** — ${target}${duration}\n` +
|
`\`${row.created_at}\` **${moderationLabel(row.action)}** — ${target}${duration}\n` +
|
||||||
`↳ par <@${row.moderator_id}> · ${row.reason || 'sans motif'}`
|
`↳ par <@${row.moderator_id}> · ${row.reason || 'sans motif'}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export async function execute(interaction) {
|
|||||||
assertModerationTarget(interaction, target);
|
assertModerationTarget(interaction, target);
|
||||||
|
|
||||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
||||||
await target.timeout(durationMs, reason ?? `Exclusion temporaire de ${minutes} minutes`);
|
await target.timeout(durationMs, reason ?? `Mise en sourdine de ${minutes} minutes`);
|
||||||
|
|
||||||
await logModerationAction(interaction, {
|
await logModerationAction(interaction, {
|
||||||
action: 'mute',
|
action: 'mute',
|
||||||
@@ -55,7 +55,7 @@ export async function execute(interaction) {
|
|||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
successEmbed(
|
successEmbed(
|
||||||
`C’est fait : **${target.user.tag}** est en exclusion temporaire pour **${formatDuration(durationMs)}**, la personne ne peut plus écrire pendant ce temps.`,
|
`C’est fait : **${target.user.tag}** est en sourdine pour **${formatDuration(durationMs)}**, la personne ne peut plus écrire pendant ce temps.`,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
+19
-9
@@ -28,16 +28,26 @@ export const ACCESS_LABELS = Object.freeze({
|
|||||||
[ACCESS_LEVELS.OWNER]: 'Owner',
|
[ACCESS_LEVELS.OWNER]: 'Owner',
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Moderation actions: Discord label, embed color and stored duration (M8). */
|
/**
|
||||||
|
* Moderation actions: Discord label, embed color and stored duration (M8).
|
||||||
|
* The emoji belongs to the entry so every surface (log channel, direct message,
|
||||||
|
* `/mod logs`, dashboard) tells a mute from a kick at a glance: the wording
|
||||||
|
* alone read like a temporary kick.
|
||||||
|
*/
|
||||||
export const MODERATION_ACTIONS = Object.freeze({
|
export const MODERATION_ACTIONS = Object.freeze({
|
||||||
warn: { label: 'Avertissement', color: COLORS.warning, duration: false },
|
warn: { label: 'Avertissement', emoji: '⚠️', color: COLORS.warning, duration: false },
|
||||||
mute: { label: 'Exclusion temporaire', color: COLORS.moderation, duration: true },
|
mute: { label: 'Mise en sourdine', emoji: '🔇', color: COLORS.moderation, duration: true },
|
||||||
unmute: { label: 'Levée d’exclusion temporaire', color: COLORS.success, duration: false },
|
unmute: {
|
||||||
kick: { label: 'Expulsion', color: COLORS.moderation, duration: false },
|
label: 'Levée de la mise en sourdine',
|
||||||
ban: { label: 'Bannissement', color: COLORS.error, duration: false },
|
emoji: '🔊',
|
||||||
unban: { label: 'Débannissement', color: COLORS.success, duration: false },
|
color: COLORS.success,
|
||||||
clear: { label: 'Suppression de messages', color: COLORS.warning, duration: false },
|
duration: false,
|
||||||
role: { label: 'Modification de rôle', color: COLORS.primary, duration: false },
|
},
|
||||||
|
kick: { label: 'Expulsion', emoji: '👢', color: COLORS.moderation, duration: false },
|
||||||
|
ban: { label: 'Bannissement', emoji: '🔨', color: COLORS.error, duration: false },
|
||||||
|
unban: { label: 'Débannissement', emoji: '🔓', color: COLORS.success, duration: false },
|
||||||
|
clear: { label: 'Supclusion de messages', emoji: '🧹', color: COLORS.warning, duration: false },
|
||||||
|
role: { label: 'Modification de rôle', emoji: '🏷️', color: COLORS.primary, duration: false },
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Ticket categories and who can see them (M0-T05 / M6-T01). */
|
/** Ticket categories and who can see them (M0-T05 / M6-T01). */
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export const GUILD_SETTINGS = Object.freeze([
|
|||||||
{
|
{
|
||||||
key: 'moderation.defaultMuteMinutes',
|
key: 'moderation.defaultMuteMinutes',
|
||||||
section: 'moderation',
|
section: 'moderation',
|
||||||
label: 'Durée d’exclusion par défaut (min)',
|
label: 'Durée de mise en sourdine par défaut (min)',
|
||||||
help: 'Proposée quand `/mute` est lancé sans durée.',
|
help: 'Proposée quand `/mute` est lancé sans durée.',
|
||||||
type: 'int',
|
type: 'int',
|
||||||
default: 60,
|
default: 60,
|
||||||
|
|||||||
@@ -7,6 +7,17 @@ import { logEvent } from '../../database/repositories/event-log-repository.js';
|
|||||||
import { recordAction } from '../../database/repositories/moderation-repository.js';
|
import { recordAction } from '../../database/repositories/moderation-repository.js';
|
||||||
import { baseEmbed } from '../../ui/embeds.js';
|
import { baseEmbed } from '../../ui/embeds.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Label shown for an action everywhere it is rendered (log channel, direct
|
||||||
|
* message, `/mod logs`, dashboard). Falls back to the raw action name, so a
|
||||||
|
* row written by another version still reads as something.
|
||||||
|
* @param {string} action
|
||||||
|
*/
|
||||||
|
export function moderationLabel(action) {
|
||||||
|
const meta = MODERATION_ACTIONS[action];
|
||||||
|
return meta ? `${meta.emoji} ${meta.label}` : action;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enforces the role hierarchy before any moderation action (M3-T05 / M8-T08).
|
* Enforces the role hierarchy before any moderation action (M3-T05 / M8-T08).
|
||||||
* @param {import('discord.js').ChatInputCommandInteraction} interaction
|
* @param {import('discord.js').ChatInputCommandInteraction} interaction
|
||||||
@@ -82,7 +93,7 @@ export async function sendModerationLog(
|
|||||||
|
|
||||||
const meta = MODERATION_ACTIONS[action];
|
const meta = MODERATION_ACTIONS[action];
|
||||||
const embed = baseEmbed(meta?.color)
|
const embed = baseEmbed(meta?.color)
|
||||||
.setTitle(`🛡️ Modération — ${meta?.label ?? action}`)
|
.setTitle(`🛡️ Modération — ${moderationLabel(action)}`)
|
||||||
.addFields(
|
.addFields(
|
||||||
{ name: 'Membre', value: targetId ? `<@${targetId}> (${targetId})` : 'Salon', inline: true },
|
{ name: 'Membre', value: targetId ? `<@${targetId}> (${targetId})` : 'Salon', inline: true },
|
||||||
{ name: 'Par', value: `<@${moderatorId}>`, inline: true },
|
{ name: 'Par', value: `<@${moderatorId}>`, inline: true },
|
||||||
@@ -117,7 +128,7 @@ export function targetNoticeEmbed({ action, guildName, reason = null, durationMs
|
|||||||
const embed = baseEmbed(meta?.color)
|
const embed = baseEmbed(meta?.color)
|
||||||
.setTitle(`Sanction sur ${guildName}`)
|
.setTitle(`Sanction sur ${guildName}`)
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`Action : **${meta?.label ?? action}**\n\nCette décision vient de l’équipe de modération. Tu peux répondre à ce message pour en parler calmement avec elle.`,
|
`Action : **${moderationLabel(action)}**\n\nCette décision vient de l’équipe de modération. Tu peux répondre à ce message pour en parler calmement avec elle.`,
|
||||||
)
|
)
|
||||||
.addFields({ name: 'Motif', value: reason || 'Non précisé' });
|
.addFields({ name: 'Motif', value: reason || 'Non précisé' });
|
||||||
if (durationMs) embed.addFields({ name: 'Durée', value: formatDuration(durationMs) });
|
if (durationMs) embed.addFields({ name: 'Durée', value: formatDuration(durationMs) });
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ChannelType, REST, Routes } from 'discord.js';
|
import { ChannelType, REST, Routes } from 'discord.js';
|
||||||
import { ACCESS_LABELS, ACCESS_LEVELS, MODERATION_ACTIONS } from '../../config/constants.js';
|
import { ACCESS_LABELS, ACCESS_LEVELS } from '../../config/constants.js';
|
||||||
import { env } from '../../config/env.js';
|
import { env } from '../../config/env.js';
|
||||||
import { ExternalApiError } from '../../core/errors.js';
|
import { ExternalApiError } from '../../core/errors.js';
|
||||||
import { createLogger } from '../../core/logger.js';
|
import { createLogger } from '../../core/logger.js';
|
||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
removeNotificationChannel,
|
removeNotificationChannel,
|
||||||
setNotificationChannel,
|
setNotificationChannel,
|
||||||
} from '../../database/repositories/notification-repository.js';
|
} from '../../database/repositories/notification-repository.js';
|
||||||
import { sendModerationLog } from '../../services/moderation/moderation-service.js';
|
import { moderationLabel, sendModerationLog } from '../../services/moderation/moderation-service.js';
|
||||||
import { badRequest, forbidden, notFound } from '../http.js';
|
import { badRequest, forbidden, notFound } from '../http.js';
|
||||||
|
|
||||||
/** Discord server management from the dashboard (M16-T05). */
|
/** Discord server management from the dashboard (M16-T05). */
|
||||||
@@ -201,7 +201,7 @@ export function registerDiscordRoutes(router) {
|
|||||||
const reason = String(body.reason ?? '').trim() || 'Non précisé';
|
const reason = String(body.reason ?? '').trim() || 'Non précisé';
|
||||||
const durationMs = action === 'mute' ? Number.parseInt(body.durationMs ?? 0, 10) : null;
|
const durationMs = action === 'mute' ? Number.parseInt(body.durationMs ?? 0, 10) : null;
|
||||||
if (action === 'mute' && (!Number.isInteger(durationMs) || durationMs <= 0)) {
|
if (action === 'mute' && (!Number.isInteger(durationMs) || durationMs <= 0)) {
|
||||||
throw badRequest('Une durée en millisecondes est requise pour une exclusion temporaire.');
|
throw badRequest('Une durée en millisecondes est requise pour une mise en sourdine.');
|
||||||
}
|
}
|
||||||
|
|
||||||
const audit = `${reason} — ${actor.displayName ?? actor.username} (tableau de bord)`;
|
const audit = `${reason} — ${actor.displayName ?? actor.username} (tableau de bord)`;
|
||||||
@@ -231,7 +231,7 @@ export function registerDiscordRoutes(router) {
|
|||||||
durationMs,
|
durationMs,
|
||||||
});
|
});
|
||||||
|
|
||||||
return { ok: true, action, label: MODERATION_ACTIONS[action]?.label ?? action };
|
return { ok: true, action, label: moderationLabel(action) };
|
||||||
},
|
},
|
||||||
{ access: ACCESS_LEVELS.STAFF },
|
{ access: ACCESS_LEVELS.STAFF },
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -33,11 +33,13 @@ const DURATIONS = [
|
|||||||
{ value: String(7 * 24 * 60 * 60_000), label: '7 jours' },
|
{ value: String(7 * 24 * 60 * 60_000), label: '7 jours' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Mirrors MODERATION_ACTIONS in `src/config/constants.js`, emoji included: the
|
||||||
|
// panel must not be the one place where a mute reads like a kick.
|
||||||
const MODERATION_ACTIONS = [
|
const MODERATION_ACTIONS = [
|
||||||
{ value: 'warn', label: 'Avertissement' },
|
{ value: 'warn', label: '⚠️ Avertissement' },
|
||||||
{ value: 'mute', label: 'Exclusion temporaire' },
|
{ value: 'mute', label: '🔇 Mise en sourdine' },
|
||||||
{ value: 'kick', label: 'Expulsion' },
|
{ value: 'kick', label: '👢 Expulsion' },
|
||||||
{ value: 'ban', label: 'Bannissement' },
|
{ value: 'ban', label: '🔨 Bannissement' },
|
||||||
];
|
];
|
||||||
|
|
||||||
async function moderate(member, reload) {
|
async function moderate(member, reload) {
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ export const VARIABLES = Object.freeze([
|
|||||||
key: 'CHANNEL_MOD_LOGS_ID',
|
key: 'CHANNEL_MOD_LOGS_ID',
|
||||||
section: 'channels',
|
section: 'channels',
|
||||||
label: 'Salon des logs de modération',
|
label: 'Salon des logs de modération',
|
||||||
help: 'Avertissements, exclusions, bannissements.',
|
help: 'Avertissements, mises en sourdine, bannissements.',
|
||||||
type: 'snowflake',
|
type: 'snowflake',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -94,6 +94,30 @@ describe('webhook entry points', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('moderation labels', () => {
|
||||||
|
it('tells every action apart by wording and emoji', async () => {
|
||||||
|
const { MODERATION_ACTIONS } = await import('../src/config/constants.js');
|
||||||
|
const { moderationLabel } = await import('../src/services/moderation/moderation-service.js');
|
||||||
|
|
||||||
|
const emojis = Object.values(MODERATION_ACTIONS).map((meta) => meta.emoji);
|
||||||
|
assert.ok(emojis.every(Boolean), 'an action has no emoji');
|
||||||
|
assert.equal(new Set(emojis).size, emojis.length, 'two actions share an emoji');
|
||||||
|
|
||||||
|
const labels = Object.keys(MODERATION_ACTIONS).map(moderationLabel);
|
||||||
|
assert.equal(new Set(labels).size, labels.length, 'two actions read the same');
|
||||||
|
assert.equal(moderationLabel('inconnu'), 'inconnu', 'an unknown action must stay readable');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('never reads a mute like a kick', async () => {
|
||||||
|
// Reported from the moderation log channel: a timeout was filed as a
|
||||||
|
// temporary kick because both labels sat next to each other.
|
||||||
|
const { moderationLabel } = await import('../src/services/moderation/moderation-service.js');
|
||||||
|
|
||||||
|
assert.equal(moderationLabel('mute'), '🔇 Mise en sourdine');
|
||||||
|
assert.equal(moderationLabel('kick'), '👢 Expulsion');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('event modules', () => {
|
describe('event modules', () => {
|
||||||
it('exports a name and a handler', async () => {
|
it('exports a name and a handler', async () => {
|
||||||
const files = (await readdir(eventsDir)).filter((file) => file.endsWith('.js'));
|
const files = (await readdir(eventsDir)).filter((file) => file.endsWith('.js'));
|
||||||
|
|||||||
Reference in new issue
Block a user