28 files
This commit is contained in:
@@ -16,10 +16,12 @@ from homeassistant.components.todo import (
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import Unauthorized
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from . import authz
|
||||
from .const import DOMAIN
|
||||
from .coordinator import TaskMateCoordinator
|
||||
from .entity import taskmate_device_info
|
||||
@@ -71,5 +73,10 @@ class TaskMateChildTodoList(CoordinatorEntity, TodoListEntity):
|
||||
|
||||
async def async_update_todo_item(self, item: TodoItem) -> None:
|
||||
"""Checking an item off completes the chore for this child."""
|
||||
ctx = getattr(self, "_context", None)
|
||||
if not await authz.async_context_allows_child(
|
||||
getattr(self, "hass", None), self.coordinator, ctx, self._child_id
|
||||
):
|
||||
raise Unauthorized(context=ctx)
|
||||
if item.status == TodoItemStatus.COMPLETED and item.uid:
|
||||
await self.coordinator.async_complete_chore(item.uid, self._child_id)
|
||||
|
||||
Reference in New Issue
Block a user