mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Fix body text of imap message not available in custom event data template (#139609)
This commit is contained in:
parent
3690e03951
commit
6abdb28a03
@ -280,7 +280,7 @@ class ImapDataUpdateCoordinator(DataUpdateCoordinator[int | None]):
|
|||||||
if self.custom_event_template is not None:
|
if self.custom_event_template is not None:
|
||||||
try:
|
try:
|
||||||
data["custom"] = self.custom_event_template.async_render(
|
data["custom"] = self.custom_event_template.async_render(
|
||||||
data, parse_result=True
|
data | {"text": message.text}, parse_result=True
|
||||||
)
|
)
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"IMAP custom template (%s) for msguid %s (%s) rendered to: %s, initial: %s",
|
"IMAP custom template (%s) for msguid %s (%s) rendered to: %s, initial: %s",
|
||||||
|
@ -726,9 +726,10 @@ async def test_message_data(
|
|||||||
[
|
[
|
||||||
("{{ subject }}", "Test subject", None),
|
("{{ subject }}", "Test subject", None),
|
||||||
('{{ "@example.com" in sender }}', True, None),
|
('{{ "@example.com" in sender }}', True, None),
|
||||||
|
('{{ "body" in text }}', True, None),
|
||||||
("{% bad template }}", None, "Error rendering IMAP custom template"),
|
("{% bad template }}", None, "Error rendering IMAP custom template"),
|
||||||
],
|
],
|
||||||
ids=["subject_test", "sender_filter", "template_error"],
|
ids=["subject_test", "sender_filter", "body_filter", "template_error"],
|
||||||
)
|
)
|
||||||
async def test_custom_template(
|
async def test_custom_template(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user