diff --git a/slack_sdk/models/blocks/blocks.py b/slack_sdk/models/blocks/blocks.py index 5bd0171d..5d672131 100644 --- a/slack_sdk/models/blocks/blocks.py +++ b/slack_sdk/models/blocks/blocks.py @@ -89,6 +89,8 @@ def parse(cls, block: Union[dict, "Block"]) -> Optional["Block"]: return HeaderBlock(**block) elif type == VideoBlock.type: return VideoBlock(**block) + elif type == RichTextBlock.type: + return RichTextBlock(**block) else: cls.logger.warning(f"Unknown block detected and skipped ({block})") return None diff --git a/tests/slack_sdk/models/test_blocks.py b/tests/slack_sdk/models/test_blocks.py index 4ea1158e..836f65b1 100644 --- a/tests/slack_sdk/models/test_blocks.py +++ b/tests/slack_sdk/models/test_blocks.py @@ -973,6 +973,7 @@ def test_complex(self): ], } self.assertDictEqual(dict_block, RichTextBlock(**dict_block).to_dict()) + self.assertDictEqual(dict_block, Block.parse(dict_block).to_dict()) _ = RichTextElementParts class_block = RichTextBlock(