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 %}