1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Make sure include_ignore=False always works with _async_current_entries (#48196)

If the step was anything other than SOURCE_USER,
include_ignore=False would not be honored
This commit is contained in:
J. Nick Koston
2021-03-21 18:57:49 -10:00
committed by GitHub
parent fd310e1f41
commit f35641ae8e
2 changed files with 117 additions and 2 deletions

View File

@@ -1021,14 +1021,20 @@ class ConfigFlow(data_entry_flow.FlowHandler):
self.context["confirm_only"] = True
@callback
def _async_current_entries(self, include_ignore: bool = False) -> list[ConfigEntry]:
def _async_current_entries(
self, include_ignore: bool | None = None
) -> list[ConfigEntry]:
"""Return current entries.
If the flow is user initiated, filter out ignored entries unless include_ignore is True.
"""
config_entries = self.hass.config_entries.async_entries(self.handler)
if include_ignore or self.source != SOURCE_USER:
if (
include_ignore is True
or include_ignore is None
and self.source != SOURCE_USER
):
return config_entries
return [entry for entry in config_entries if entry.source != SOURCE_IGNORE]