From 96ba48bcba42521bebb09bf4ff02708822b61ae7 Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Tue, 17 Feb 2026 14:04:17 +0300 Subject: [PATCH] only set the flag if the user has a single voucher --- handlers/application/vouchers.go | 8 ++++++++ services/registration/pp.csv | 1 + 2 files changed, 9 insertions(+) diff --git a/handlers/application/vouchers.go b/handlers/application/vouchers.go index cad629b..e0cd20c 100644 --- a/handlers/application/vouchers.go +++ b/handlers/application/vouchers.go @@ -33,6 +33,7 @@ func (h *MenuHandlers) ManageVouchers(ctx context.Context, sym string, input []b flag_no_active_voucher, _ := h.flagManager.GetFlag("flag_no_active_voucher") flag_api_error, _ := h.flagManager.GetFlag("flag_api_call_error") flag_no_stable_vouchers, _ := h.flagManager.GetFlag("flag_no_stable_vouchers") + flag_single_voucher, _ := h.flagManager.GetFlag("flag_single_voucher") publicKey, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY) if err != nil { @@ -73,6 +74,13 @@ func (h *MenuHandlers) ManageVouchers(ctx context.Context, sym string, input []b return res, nil } + // only set the flag if the user has a single voucher + if len(vouchersResp) == 1 { + res.FlagSet = append(res.FlagSet, flag_single_voucher) + } else { + res.FlagReset = append(res.FlagReset, flag_single_voucher) + } + res.FlagReset = append(res.FlagReset, flag_no_active_voucher) // add a variable to filter out the active voucher diff --git a/services/registration/pp.csv b/services/registration/pp.csv index 3911af7..9a3ebec 100644 --- a/services/registration/pp.csv +++ b/services/registration/pp.csv @@ -37,3 +37,4 @@ flag,flag_low_swap_amount,43,this is set when the swap max limit is less than 0. flag,flag_alias_unavailable,44,this is set when the preferred alias is not available flag,flag_swap_transaction,45,this is set when the transaction will involve performing a swap flag,flag_no_stable_vouchers,46,this is set when the user does not have a stable voucher +flag,flag_single_voucher,47,this is set when the user only has a single voucher