Skip to content

Commit

Permalink
Fixed multi static select state lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
Jnesselr committed Jan 13, 2025
1 parent 1214fb7 commit b17dd6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/External/Slack/Modals/EquipmentAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 3 additions & 2 deletions app/External/Slack/Modals/ModalTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ?? [];
Expand All @@ -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'];
Expand Down

0 comments on commit b17dd6c

Please sign in to comment.