fix(bug-report): correction de la récupération des valeurs dans les modals de bug et de suggestion
This commit is contained in:
parent
9731e10ee0
commit
10558c47ec
1 changed files with 46 additions and 39 deletions
|
|
@ -36,9 +36,6 @@ def save_report(issue_iid, user_id):
|
|||
|
||||
class BugReportModal(disnake.ui.Modal):
|
||||
def __init__(self, priority_choice):
|
||||
super().__init__(title="Signaler un Bug", components=[self.bug_title, self.description])
|
||||
|
||||
# Sécurisation: éviter les valeurs None qui finissent dans GitLab
|
||||
if priority_choice is None:
|
||||
self.priority_choice = type(
|
||||
"PriorityChoice",
|
||||
|
|
@ -48,32 +45,38 @@ class BugReportModal(disnake.ui.Modal):
|
|||
else:
|
||||
self.priority_choice = priority_choice
|
||||
|
||||
bug_title = disnake.ui.TextInput(
|
||||
super().__init__(
|
||||
title="Signaler un Bug",
|
||||
components=[
|
||||
disnake.ui.TextInput(
|
||||
label="Titre du bug",
|
||||
placeholder="Décrivez brièvement le problème...",
|
||||
custom_id="bug_title",
|
||||
required=True,
|
||||
max_length=100,
|
||||
)
|
||||
|
||||
description = disnake.ui.TextInput(
|
||||
),
|
||||
disnake.ui.TextInput(
|
||||
label="Description détaillée",
|
||||
style=disnake.TextInputStyle.paragraph,
|
||||
placeholder="Que s'est-il passé ? Comment reproduire le bug ?",
|
||||
custom_id="bug_description",
|
||||
required=True,
|
||||
max_length=1000,
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
async def callback(self, interaction: disnake.Interaction):
|
||||
async def callback(self, interaction: disnake.ModalInteraction):
|
||||
await interaction.response.send_message("Envoi de votre rapport de bug à GitLab...", ephemeral=True)
|
||||
|
||||
bug_title = (self.bug_title.value or "").strip()
|
||||
bug_title = (interaction.text_values.get("bug_title") or "").strip()
|
||||
if not bug_title:
|
||||
bug_title = "Sans titre"
|
||||
|
||||
priority_name = getattr(self.priority_choice, "name", None) or "Normal"
|
||||
priority_value = getattr(self.priority_choice, "value", None) or "Normal"
|
||||
|
||||
description_value = self.description.value or ""
|
||||
description_value = interaction.text_values.get("bug_description") or ""
|
||||
|
||||
description_text = f"**Rapporté par:** {interaction.user} ({interaction.user.id})\n"
|
||||
description_text += f"**Priorité:** {priority_name}\n\n"
|
||||
|
|
@ -105,28 +108,32 @@ class BugReportModal(disnake.ui.Modal):
|
|||
|
||||
class FeatureSuggestionModal(disnake.ui.Modal):
|
||||
def __init__(self):
|
||||
super().__init__(title="Suggérer une fonctionnalité", components=[self.suggestion_title, self.description])
|
||||
|
||||
suggestion_title = disnake.ui.TextInput(
|
||||
super().__init__(
|
||||
title="Suggérer une fonctionnalité",
|
||||
components=[
|
||||
disnake.ui.TextInput(
|
||||
label="Titre de la suggestion",
|
||||
placeholder="Que voulez-vous ajouter ?",
|
||||
custom_id="suggestion_title",
|
||||
required=True,
|
||||
max_length=100,
|
||||
)
|
||||
|
||||
description = disnake.ui.TextInput(
|
||||
),
|
||||
disnake.ui.TextInput(
|
||||
label="Détails de la fonctionnalité",
|
||||
style=disnake.TextInputStyle.paragraph,
|
||||
placeholder="Décrivez comment cela devrait fonctionner...",
|
||||
custom_id="suggestion_description",
|
||||
required=True,
|
||||
max_length=1000,
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
async def callback(self, interaction: disnake.Interaction):
|
||||
async def callback(self, interaction: disnake.ModalInteraction):
|
||||
await interaction.response.send_message("Envoi de votre suggestion à GitLab...", ephemeral=True)
|
||||
|
||||
suggestion_title = (self.suggestion_title.value or "").strip() or "Sans titre"
|
||||
description_value = self.description.value or ""
|
||||
suggestion_title = (interaction.text_values.get("suggestion_title") or "").strip() or "Sans titre"
|
||||
description_value = interaction.text_values.get("suggestion_description") or ""
|
||||
|
||||
description_text = f"**Suggéré par:** {interaction.user} ({interaction.user.id})\n\n"
|
||||
description_text += f"**Description:**\n{description_value}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue