From ecf59d645e1f9f92db202e994157f6a58338ab33 Mon Sep 17 00:00:00 2001 From: Mow910 Date: Sun, 3 May 2026 14:20:18 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20ne=20pas=20effacer=20les=20r=C3=B4les=20?= =?UTF-8?q?mod=C3=A9ration=20si=20le=20formulaire=20n=E2=80=99inclut=20pas?= =?UTF-8?q?=20la=20liste=20(bot=20pas=20pr=C3=AAt)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- webapp/configurations.py | 11 +++++++---- webapp/templates/configurations.html | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/webapp/configurations.py b/webapp/configurations.py index bd6f13d..d6e0251 100644 --- a/webapp/configurations.py +++ b/webapp/configurations.py @@ -26,11 +26,14 @@ def updateConfiguration(): 'twitch_commands_enable': 'twitch_channel' } + # Ne mettre à jour les rôles staff que si la liste a été rendue dans le formulaire. + # Sinon (bot pas encore prêt, guilds vides), getlist est vide et on écrasait la config en base. staff_roles = request.form.getlist('moderation_staff_role_ids') - if staff_roles: - ConfigurationHelper().createOrUpdate('moderation_staff_role_ids', ','.join(staff_roles)) - else: - ConfigurationHelper().createOrUpdate('moderation_staff_role_ids', '') + if request.form.get('moderation_roles_in_form'): + if staff_roles: + ConfigurationHelper().createOrUpdate('moderation_staff_role_ids', ','.join(staff_roles)) + else: + ConfigurationHelper().createOrUpdate('moderation_staff_role_ids', '') for key in request.form: if key == 'moderation_staff_role_ids': diff --git a/webapp/templates/configurations.html b/webapp/templates/configurations.html index 11610fa..cefb506 100644 --- a/webapp/templates/configurations.html +++ b/webapp/templates/configurations.html @@ -159,6 +159,9 @@
+ {% if roles %} + + {% endif %} {% set selected_roles = (configuration.getValue('moderation_staff_role_ids') or '').split(',') %} {% if roles|length > 1 %}