From 5466db73e2f93aa77dbd5cc396adcb0efe42e24d Mon Sep 17 00:00:00 2001 From: Changaco Date: Mon, 30 Sep 2024 10:46:43 +0200 Subject: [PATCH] implement unsetting `is_default_for` on a route --- www/%username/routes/index.spt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/www/%username/routes/index.spt b/www/%username/routes/index.spt index ba93bbd1a..606f9cb7c 100644 --- a/www/%username/routes/index.spt +++ b/www/%username/routes/index.spt @@ -23,7 +23,9 @@ if request.method == 'POST': try: route_id, currency = request.body['set_as_default_for'].split(':') route_id = int(route_id) - if currency not in constants.CURRENCIES: + if currency == '': + currency = None + elif currency not in constants.CURRENCIES: raise ValueError(currency) except ValueError: raise response.invalid_input(request.body['set_as_default_for'], 'set_as_default_for', 'body') @@ -184,7 +186,16 @@ title = _("Payment Instruments") % if route.network == 'stripe-card' and not route.is_default % endif - % if last_payin and participant.donates_in_multiple_currencies and not route.is_default_for + % if route.is_default_for + + % elif route.network != 'stripe-card' and last_payin and participant.donates_in_multiple_currencies