Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
email_notifications: Fix inline-ing of image-URL-only messages.
fe25517 adjusted the email_notifications codepath to use `lxml.html.fragment_fromstring` method when parsing `rendered_content`, but left the tests using a helper which called `fromstring`. Switching the tests to match the code as run reveals a bug -- using `drop_tree` on all `message_inline_image` classes now _does_ remove all of a top-level image-URL-only message. Previously, such messages were "safe" from the block that calls `drop_tree` only by dint of `drop_tree` being a silent no-op for the root element. When parsed using `fragment_fromstring`, they are no longer the root, and as such an empty message results. Reorder relative_to_full_url to check for only one `message_inline_image` within the top `<div>`, and only run the `drop_tree` path in the alternate case. Tests must be adjusted for their output now including one more layer of `<div>`.
- Loading branch information
Showing
2 changed files
with
34 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters