Fix update person validation (#30691)
parent
4dc39492a5
commit
117efb5a04
|
@ -214,7 +214,7 @@ class PersonStorageCollection(collection.StorageCollection):
|
|||
|
||||
user_id = update_data.get(CONF_USER_ID)
|
||||
|
||||
if user_id is not None:
|
||||
if user_id is not None and user_id != data.get(CONF_USER_ID):
|
||||
await self._validate_user_id(user_id)
|
||||
|
||||
return {**data, **update_data}
|
||||
|
|
|
@ -514,6 +514,18 @@ async def test_ws_update(hass, hass_ws_client, storage_setup):
|
|||
"id": 6,
|
||||
"type": "person/update",
|
||||
"person_id": persons[0]["id"],
|
||||
"user_id": persons[0]["user_id"],
|
||||
}
|
||||
)
|
||||
resp = await client.receive_json()
|
||||
|
||||
assert resp["success"]
|
||||
|
||||
resp = await client.send_json(
|
||||
{
|
||||
"id": 7,
|
||||
"type": "person/update",
|
||||
"person_id": persons[0]["id"],
|
||||
"name": "Updated Name",
|
||||
"device_trackers": [DEVICE_TRACKER_2],
|
||||
"user_id": None,
|
||||
|
|
Loading…
Reference in New Issue