182 files
This commit is contained in:
@@ -22,7 +22,6 @@ from ..const import (
|
||||
DEFAULT_WARNING_DAYS,
|
||||
DOMAIN,
|
||||
FLAT_SCHEDULE_TYPES,
|
||||
GLOBAL_UNIQUE_ID,
|
||||
MAX_ASSIGNEE_POOL,
|
||||
MAX_CHECKLIST_ITEM_LENGTH,
|
||||
MAX_CHECKLIST_ITEMS,
|
||||
@@ -42,6 +41,7 @@ from ..const import (
|
||||
)
|
||||
from ..helpers.dates import INTERVAL_UNITS
|
||||
from ..helpers.permissions import require_write
|
||||
from ..helpers.sanitize import strip_task_runtime_state
|
||||
from ..helpers.schedule import (
|
||||
FLAT_RECURRENCE_KEYS,
|
||||
KIND_INTERVAL,
|
||||
@@ -719,10 +719,10 @@ async def async_delete_task(
|
||||
# persistent and task-id keyed — without this, deleted ids accumulate
|
||||
# there forever and confuse the vacation preview UI.
|
||||
from ..const import CONF_VACATION_EXEMPT_TASK_IDS
|
||||
from ..helpers.global_options import get_global_entry
|
||||
|
||||
for ge in hass.config_entries.async_entries(DOMAIN):
|
||||
if ge.unique_id != GLOBAL_UNIQUE_ID:
|
||||
continue
|
||||
ge = get_global_entry(hass)
|
||||
if ge is not None:
|
||||
exempt = ge.options.get(CONF_VACATION_EXEMPT_TASK_IDS) or []
|
||||
if isinstance(exempt, list) and task_id in exempt:
|
||||
hass.config_entries.async_update_entry(
|
||||
@@ -732,7 +732,6 @@ async def async_delete_task(
|
||||
CONF_VACATION_EXEMPT_TASK_IDS: [t for t in exempt if t != task_id],
|
||||
},
|
||||
)
|
||||
break
|
||||
|
||||
# Clean up any repair issues referencing this task
|
||||
if old_trigger_config:
|
||||
@@ -786,10 +785,7 @@ async def ws_duplicate_task(
|
||||
new_task["name"] = f"{base_name} (copy)"[:MAX_NAME_LENGTH]
|
||||
new_task["created_at"] = dt_util.now().date().isoformat()
|
||||
# Never carry over per-task-unique keys or any stray dynamic state.
|
||||
for key in ("entity_slug", "nfc_tag_id", "history", "last_performed", "last_planned_due", "adaptive_config"):
|
||||
new_task.pop(key, None)
|
||||
if isinstance(new_task.get("trigger_config"), dict):
|
||||
new_task["trigger_config"].pop("_trigger_state", None)
|
||||
strip_task_runtime_state(new_task)
|
||||
|
||||
await async_persist_task(hass, entry, new_task)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user