Add missing config flow abort strings (#86180)

* Add missing `already_configured` and `already_in_progress` abort strings

* Note required strings.json entries in config_entries aborting functions
This commit is contained in:
Ville Skyttä
2023-01-24 08:59:32 +02:00
committed by GitHub
parent 3ec7f0280e
commit 5f0adfe6e4
47 changed files with 112 additions and 2 deletions

View File

@@ -1455,7 +1455,10 @@ class ConfigFlow(data_entry_flow.FlowHandler):
def _async_abort_entries_match(
self, match_dict: dict[str, Any] | None = None
) -> None:
"""Abort if current entries match all data."""
"""Abort if current entries match all data.
Requires `already_configured` in strings.json in user visible flows.
"""
if match_dict is None:
match_dict = {} # Match any entry
for entry in self._async_current_entries(include_ignore=False):
@@ -1477,7 +1480,11 @@ class ConfigFlow(data_entry_flow.FlowHandler):
*,
error: str = "already_configured",
) -> None:
"""Abort if the unique ID is already configured."""
"""Abort if the unique ID is already configured.
Requires strings.json entry corresponding to the `error` parameter
in user visible flows.
"""
if self.unique_id is None:
return
@@ -1619,6 +1626,9 @@ class ConfigFlow(data_entry_flow.FlowHandler):
when the handler has no existing config entries.
It ensures that the discovery can be ignored by the user.
Requires `already_configured` and `already_in_progress` in strings.json
in user visible flows.
"""
if self.unique_id is not None:
return