fix: ne pas effacer les rôles modération si le formulaire n’inclut pas la liste (bot pas prêt)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -26,11 +26,14 @@ def updateConfiguration():
|
|||||||
'twitch_commands_enable': 'twitch_channel'
|
'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')
|
staff_roles = request.form.getlist('moderation_staff_role_ids')
|
||||||
if staff_roles:
|
if request.form.get('moderation_roles_in_form'):
|
||||||
ConfigurationHelper().createOrUpdate('moderation_staff_role_ids', ','.join(staff_roles))
|
if staff_roles:
|
||||||
else:
|
ConfigurationHelper().createOrUpdate('moderation_staff_role_ids', ','.join(staff_roles))
|
||||||
ConfigurationHelper().createOrUpdate('moderation_staff_role_ids', '')
|
else:
|
||||||
|
ConfigurationHelper().createOrUpdate('moderation_staff_role_ids', '')
|
||||||
|
|
||||||
for key in request.form:
|
for key in request.form:
|
||||||
if key == 'moderation_staff_role_ids':
|
if key == 'moderation_staff_role_ids':
|
||||||
|
|||||||
@@ -159,6 +159,9 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Rôles Staff autorisés</label>
|
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Rôles Staff autorisés</label>
|
||||||
|
{% if roles %}
|
||||||
|
<input type="hidden" name="moderation_roles_in_form" value="1">
|
||||||
|
{% endif %}
|
||||||
{% set selected_roles = (configuration.getValue('moderation_staff_role_ids') or '').split(',') %}
|
{% set selected_roles = (configuration.getValue('moderation_staff_role_ids') or '').split(',') %}
|
||||||
|
|
||||||
{% if roles|length > 1 %}
|
{% if roles|length > 1 %}
|
||||||
|
|||||||
Reference in New Issue
Block a user