Fix prototype state user isolation
This commit is contained in:
parent
19c85db89a
commit
fabedb105b
2 changed files with 7 additions and 2 deletions
|
|
@ -44,7 +44,7 @@ class PrototypeStateStore:
|
|||
if existing is not None:
|
||||
stored = existing.model_copy(update={"is_new": False})
|
||||
self._users[key] = stored
|
||||
return stored
|
||||
return stored.model_copy()
|
||||
|
||||
user = User(
|
||||
user_id=f"usr-{platform}-{external_id}",
|
||||
|
|
@ -55,7 +55,7 @@ class PrototypeStateStore:
|
|||
is_new=True,
|
||||
)
|
||||
self._users[key] = user
|
||||
return user
|
||||
return user.model_copy()
|
||||
|
||||
async def get_settings(self, user_id: str) -> UserSettings:
|
||||
stored = self._settings.get(user_id, {})
|
||||
|
|
|
|||
|
|
@ -21,9 +21,14 @@ async def test_get_or_create_user_is_stable_per_surface_identity():
|
|||
|
||||
assert first.user_id == "usr-matrix-@alice:example.org"
|
||||
assert first.is_new is True
|
||||
|
||||
first.display_name = "Mallory"
|
||||
first.is_new = False
|
||||
|
||||
assert second.user_id == first.user_id
|
||||
assert second.is_new is False
|
||||
assert second.display_name == "Alice"
|
||||
assert store._users["matrix:@alice:example.org"].display_name == "Alice"
|
||||
assert store._users["matrix:@alice:example.org"].is_new is False
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue