🐛 (buttons) Improve buttons matching when dynamic
Closes #1432, closes #1442
This commit is contained in:
@@ -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,
|
||||||
})),
|
})),
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user