refactor(ui): give every message one friendly, ungendered voice
Members read all replies as one voice, so the wording now lives in one place:
the shared titles, the list marker and the "what to do next" hint come from
src/ui/embeds.js, and every module follows them.
An error explains the cause, recalls the rule and offers the way out instead of
blaming; a success says what happens next. Nothing agrees on the gender of a
person ("utilisateur", "cher/chère", "ravie"), which also keeps the sentences
shorter. Two tests lock the shared titles and reject gendered descriptions.
This commit is contained in:
31 files changed
+469
-201
No files matched your search
@@ -15,7 +15,9 @@ const PR_CONTEXT_TTL_MS = 10 * 60_000;
|
||||
/** Fails fast with an actionable message when Gitea is not configured (M5-T01). */
|
||||
export function assertGiteaConfigured() {
|
||||
if (!isGiteaConfigured()) {
|
||||
throw new UserFacingError('Gitea n’est pas configuré : renseigne `GITEA_URL` et `GITEA_TOKEN`.');
|
||||
throw new UserFacingError(
|
||||
'La partie Gitea n’est pas encore configurée : il manque `GITEA_URL` et `GITEA_TOKEN` dans le `.env`. Tout le reste du bot fonctionne sans cela.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +70,8 @@ export async function replyGiteaFailure(interaction, error) {
|
||||
log.error('Gitea request failed', error);
|
||||
const detail =
|
||||
error instanceof ExternalApiError && /not configured/.test(error.message)
|
||||
? 'Gitea n’est pas configuré.'
|
||||
: 'Gitea est momentanément indisponible. Réessaie dans quelques instants.';
|
||||
? 'La partie Gitea n’est pas encore configurée : il manque `GITEA_URL` et `GITEA_TOKEN` dans le `.env`.'
|
||||
: 'Gitea ne répond pas pour le moment. Réessaie dans quelques instants — si ça persiste, préviens l’équipe.';
|
||||
const payload = { embeds: [errorEmbed(detail)], flags: MessageFlags.Ephemeral };
|
||||
|
||||
if (interaction.deferred || interaction.replied) {
|
||||
@@ -107,7 +109,9 @@ export async function submitPullRequestModal(interaction) {
|
||||
assertGiteaConfigured();
|
||||
const context = consume(`pr:${interaction.user.id}`);
|
||||
if (!context) {
|
||||
throw new UserFacingError('Session expirée : relance `/pr create` pour choisir à nouveau les branches.');
|
||||
throw new UserFacingError(
|
||||
'La sélection des branches a expiré : relance `/pr create` pour les choisir à nouveau.',
|
||||
);
|
||||
}
|
||||
|
||||
await interaction.deferReply();
|
||||
|
||||
Reference in new issue
Block a user