mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 20:02:15 +00:00
widgets: Fix bug where a new line right after /todo broke rendering.
When there was no space right after `/todo` but there was content on a new line, the message would be rendered plainly, not as a todo widget. This was because we split on only the space character to then check if the first token was a valid widget. Now we split on both spaces and newlines to extract the widget name, irrespective of whether it is followed by a space or a newline. This results in the message being rendered as a todo widget as expected.
This commit is contained in:
@@ -8,7 +8,7 @@ from zerver.models import Message, SubMessage
|
||||
|
||||
def get_widget_data(content: str) -> Tuple[Optional[str], Optional[str]]:
|
||||
valid_widget_types = ["poll", "todo"]
|
||||
tokens = content.split(" ")
|
||||
tokens = re.split(r"\s+|\n+", content)
|
||||
|
||||
# tokens[0] will always exist
|
||||
if tokens[0].startswith("/"):
|
||||
|
||||
Reference in New Issue
Block a user