Debug GitLab note DM
This commit is contained in:
parent
8efd0dc61c
commit
761e7c0e16
2 changed files with 35 additions and 12 deletions
19
TODO.md
19
TODO.md
|
|
@ -1,9 +1,12 @@
|
||||||
# TODO - Panel sanctions (components V2)
|
# TODO - Corrections GitLab -> MP commentaire
|
||||||
|
|
||||||
|
- [ ] Ajouter des logs détaillés dans `commandes/bug_report.py` pour vérifier :
|
||||||
|
- [ ] réception webhook (object_kind)
|
||||||
|
- [ ] issue_iid extrait
|
||||||
|
- [ ] présence de `system` et filtrage
|
||||||
|
- [ ] chargement du user_id depuis `data/gitlab_reports.json`
|
||||||
|
- [ ] tentative d’envoi DM (user.id)
|
||||||
|
- [ ] Ajouter un fallback si `note_attr.note/body` n’est pas présent.
|
||||||
|
- [ ] Redéployer (commit + git push + restart bot/PM2 si nécessaire).
|
||||||
|
- [ ] Vérifier avec un vrai commentaire GitLab.
|
||||||
|
|
||||||
- [ ] Revoir `commandes/moderation.py` : ajouter `panel_channel_id` dans la table `mod_config`
|
|
||||||
- [ ] Mettre à jour `/modconfig` avec un nouveau bouton/sélecteur “Salon sanctions” (ChannelSelect) (style components V2, callbacks dédiés)
|
|
||||||
- [ ] Ajouter un formatter “panneau sanctions” (liste bullets + citations/raison + date + modérateur + durée si TIMEOUT)
|
|
||||||
- [ ] Ajouter une fonction `send_sanction_panel(...)` et l’appeler dans `warn`, `timeout`, `kick`, `ban` (push automatique)
|
|
||||||
- [ ] Enrichir `/modpanel` pour afficher les sanctions actives récentes “proprement” (et garder l’UI actuelle)
|
|
||||||
- [ ] Nettoyer les callbacks (supprimer les `lambda` dans `ModConfigView` si présents)
|
|
||||||
- [ ] Tester localement : `/modconfig` -> config channel, puis exécuter des sanctions et vérifier l’affichage dans le salon
|
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ class BugReportModal(disnake.ui.Modal):
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(
|
||||||
content=(
|
content=(
|
||||||
"✅ Votre bug a été signalé avec succès ! "
|
"✅ Votre bug a été signalé avec succès ! "
|
||||||
"Gameur a bien été averti et le bug sera réglé dans la prochaine mise à jour. "
|
"Nous avons bien été averti et le bug sera réglé dans la prochaine mise à jour. "
|
||||||
f"[Voir l'issue]({result.get('web_url')})"
|
f"[Voir l'issue]({result.get('web_url')})"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -259,6 +259,19 @@ class BugReport(commands.Cog):
|
||||||
if not user:
|
if not user:
|
||||||
return web.json_response({"status": "user not found"}, status=200)
|
return web.json_response({"status": "user not found"}, status=200)
|
||||||
|
|
||||||
|
# DEBUG: log brute payload minimal pour comprendre pourquoi aucun DM n'est envoyé
|
||||||
|
kuby_logger.info(
|
||||||
|
f"[GitLab webhook] event_type={event_type} issue_iid={issue_iid} "
|
||||||
|
f"tracked_user_id={user_id} payload_keys={list(payload.keys())[:20]}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if event_type == "note":
|
||||||
|
note_obj_attrs = payload.get("object_attributes") or {}
|
||||||
|
kuby_logger.info(
|
||||||
|
f"[GitLab note] system={note_obj_attrs.get('system', False)} "
|
||||||
|
f"note_len={len(str(note_obj_attrs.get('note') or note_obj_attrs.get('body') or payload.get('note') or ''))}"
|
||||||
|
)
|
||||||
|
|
||||||
app_info = await self.bot.application_info()
|
app_info = await self.bot.application_info()
|
||||||
dev = app_info.owner
|
dev = app_info.owner
|
||||||
issue_title = payload.get("object_attributes", {}).get("title", f"#{issue_iid}")
|
issue_title = payload.get("object_attributes", {}).get("title", f"#{issue_iid}")
|
||||||
|
|
@ -378,6 +391,11 @@ class BugReport(commands.Cog):
|
||||||
note_attr = payload.get("object_attributes", {})
|
note_attr = payload.get("object_attributes", {})
|
||||||
is_system = note_attr.get("system", False)
|
is_system = note_attr.get("system", False)
|
||||||
|
|
||||||
|
kuby_logger.info(
|
||||||
|
f"[GitLab note] dispatch started issue_iid={issue_iid} is_system={is_system} "
|
||||||
|
f"note_field_present={bool(note_attr.get('note') or note_attr.get('body'))}"
|
||||||
|
)
|
||||||
|
|
||||||
if not is_system:
|
if not is_system:
|
||||||
# GitLab peut envoyer des champs différents selon version/config
|
# GitLab peut envoyer des champs différents selon version/config
|
||||||
note_body = (
|
note_body = (
|
||||||
|
|
@ -421,7 +439,10 @@ class BugReport(commands.Cog):
|
||||||
f"⚠️ [DM BLOQUÉ] Impossible d'envoyer votre commentaire à {user} ({user.id}) pour l'issue #{issue_iid} (DMs désactivés)."
|
f"⚠️ [DM BLOQUÉ] Impossible d'envoyer votre commentaire à {user} ({user.id}) pour l'issue #{issue_iid} (DMs désactivés)."
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
kuby_logger.error(f"Erreur inattendue dans la notification de commentaire : {e}")
|
kuby_logger.error(
|
||||||
|
f"Erreur inattendue dans la notification de commentaire : {e}",
|
||||||
|
exc_info=True,
|
||||||
|
)
|
||||||
|
|
||||||
return web.json_response({"status": "success"}, status=200)
|
return web.json_response({"status": "success"}, status=200)
|
||||||
|
|
||||||
|
|
@ -463,5 +484,4 @@ class BugReport(commands.Cog):
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(BugReport(bot))
|
bot.add_cog(BugReport(bot))
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue