From b12fcef1b39c1b7718555d3def618572a91007b3 Mon Sep 17 00:00:00 2001 From: Mo8it Date: Sun, 26 Feb 2023 14:07:06 +0100 Subject: [PATCH] Add optional word --- src/config.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/config.rs b/src/config.rs index b56957f..e208b9f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -149,6 +149,20 @@ impl Config { config.state_config.strings.message_from = config.state_config.strings.message_from.trim().to_string() + " "; + // Add the optional word to fields without a required_feedback. + config + .state_config + .custom_fields + .iter_mut() + .filter(|field| field.required_feedback.is_none()) + .for_each(|field| { + field.label = format!( + "{} ({})", + field.label.trim(), + config.state_config.strings.optional + ); + }); + Ok(config) } }