diff --git a/slackblocks/elements.py b/slackblocks/elements.py index e9ed9a5..7b8fc16 100644 --- a/slackblocks/elements.py +++ b/slackblocks/elements.py @@ -697,9 +697,7 @@ def _resolve(self) -> Dict[str, Any]: user_multi_select = self._attributes() user_multi_select["action_id"] = self.action_id if self.initial_users: - user_multi_select["initial_users"] = [ - initial_option._resolve() for initial_option in self.initial_users - ] + user_multi_select["initial_users"] = self.initial_users if self.confirm: user_multi_select["confirm"] = self.confirm._resolve() if self.max_selected_items: diff --git a/test/samples/elements/multi_select_user_with_initial_users.json b/test/samples/elements/multi_select_user_with_initial_users.json new file mode 100644 index 0000000..b46a820 --- /dev/null +++ b/test/samples/elements/multi_select_user_with_initial_users.json @@ -0,0 +1,12 @@ +{ + "type": "multi_users_select", + "action_id": "multi_users_select", + "initial_users": [ + "U064B5H1309", + "U063JR973UP" + ], + "placeholder": { + "type": "plain_text", + "text": "Select one or more users" + } +} \ No newline at end of file diff --git a/test/unit/test_elements.py b/test/unit/test_elements.py index c8a5921..5f25fb9 100644 --- a/test/unit/test_elements.py +++ b/test/unit/test_elements.py @@ -165,6 +165,16 @@ def test_multi_select_user() -> None: multi_select_user ) +def test_multi_select_user_with_initial_users() -> None: + multi_select_user = UserMultiSelectMenu( + action_id="multi_users_select", + placeholder=Text("Select one or more users", type_=TextType.PLAINTEXT), + initial_users= ["U064B5H1309", "U063JR973UP"], + ) + assert fetch_sample(path="test/samples/elements/multi_select_user_with_initial_users.json") == repr( + multi_select_user + ) + def test_number_input_basic() -> None: number_input = NumberInput(action_id="number_input", is_decimal_allowed=False)