2
0

🐛 (buttons) Improve buttons matching when dynamic

Closes #1432, closes #1442
This commit is contained in:
Baptiste Arnaud
2024-04-11 12:16:55 +02:00
parent 7d6cf2ad54
commit d194fbec45
2 changed files with 2 additions and 3 deletions

View File

@@ -24,7 +24,7 @@ export const injectVariableValuesInButtonsInputBlock =
return { return {
...deepParseVariables(variables)(block), ...deepParseVariables(variables)(block),
items: value.filter(isDefined).map((item, idx) => ({ items: value.filter(isDefined).map((item, idx) => ({
id: idx.toString(), id: 'choice' + idx.toString(),
blockId: block.id, blockId: block.id,
content: item, content: item,
})), })),

View File

@@ -71,8 +71,7 @@ export const parseButtonsReply =
const matchedItem = longestItemsFirst.find( const matchedItem = longestItemsFirst.find(
(item) => (item) =>
item.id === inputValue || item.id === inputValue ||
(item.content && (item.content && inputValue.trim() === item.content.trim())
inputValue.toLowerCase().trim() === item.content.toLowerCase().trim())
) )
if (!matchedItem) return { status: 'fail' } if (!matchedItem) return { status: 'fail' }
return { return {