push_notifications: Handle empty rendered_messages.

This parallels fe25517295, but for mobile notifications.  It also
adds a test, which verifies that such content does not crash either
mobile or email notifications.
This commit is contained in:
Alex Vandiver
2021-09-14 15:10:28 -07:00
committed by Alex Vandiver
parent 039b869ca5
commit 8c72959951
2 changed files with 7 additions and 1 deletions

View File

@@ -636,7 +636,7 @@ def get_mobile_push_content(rendered_content: str) -> str:
+ "*"
)
elem = lxml.html.fromstring(rendered_content)
elem = lxml.html.fragment_fromstring(rendered_content, create_parent=True)
plain_text = process(elem)
return plain_text