From b17dd6c35f3950d59d4874a204f68e5db093a61c Mon Sep 17 00:00:00 2001 From: Justin Nesselrotte Date: Mon, 13 Jan 2025 09:14:40 -0700 Subject: [PATCH] Fixed multi static select state lookup --- app/External/Slack/Modals/EquipmentAuthorization.php | 2 +- app/External/Slack/Modals/ModalTrait.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/External/Slack/Modals/EquipmentAuthorization.php b/app/External/Slack/Modals/EquipmentAuthorization.php index eaf76c4..92c57b8 100644 --- a/app/External/Slack/Modals/EquipmentAuthorization.php +++ b/app/External/Slack/Modals/EquipmentAuthorization.php @@ -59,7 +59,7 @@ public function __construct(?Customer $user) element: Kit::multiExternalSelectMenu( actionId: self::PERSON_DROPDOWN, placeholder: 'Select a member', - minQueryLength: 2 + minQueryLength: 0 ), ), Kit::input( diff --git a/app/External/Slack/Modals/ModalTrait.php b/app/External/Slack/Modals/ModalTrait.php index a9f855e..f730d9f 100644 --- a/app/External/Slack/Modals/ModalTrait.php +++ b/app/External/Slack/Modals/ModalTrait.php @@ -121,7 +121,8 @@ protected static function getStateValues(SlackRequest $request): array foreach ($values as $blockId => $blockValues) { $result[$blockId] = []; foreach ($blockValues as $actionId => $actionValues) { - if ($actionValues['type'] == 'checkboxes') { + $type = $actionValues['type']; + if ($type == 'checkboxes') { // Checkboxes are kind of weird with Slack. Instead of just true/false, // their values are either there or not. So we return a dictionary of values. $selectedOptions = $actionValues['selected_options'] ?? []; @@ -134,7 +135,7 @@ protected static function getStateValues(SlackRequest $request): array foreach ($selectedOptions as $option) { $result[$blockId][$actionId][] = $option['value']; } - } elseif ($actionValues['type'] == 'multi_external_select') { + } elseif ($type == 'multi_external_select' || $type == 'multi_static_select') { $selected = []; foreach ($actionValues['selected_options'] as $selectedOption) { $selected[] = $selectedOption['value'];