mirror of
https://github.com/element-hq/synapse
synced 2024-08-20 16:40:20 +00:00
De-localpart ProfileWorkerStore.create_profile()
Signed-off-by: Sean Quah <seanq@matrix.org>
This commit is contained in:
parent
96bb319d14
commit
76d6379727
4 changed files with 9 additions and 6 deletions
|
@ -99,9 +99,12 @@ class ProfileWorkerStore(SQLBaseStore):
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
async def create_profile(self, user_localpart: str) -> None:
|
async def create_profile(self, user_id: str) -> None:
|
||||||
|
user_localpart = UserID.from_string(user_id).localpart
|
||||||
await self.db_pool.simple_insert(
|
await self.db_pool.simple_insert(
|
||||||
table="profiles", values={"user_id": user_localpart}, desc="create_profile"
|
table="profiles",
|
||||||
|
values={"user_id": user_localpart, "full_user_id": user_id},
|
||||||
|
desc="create_profile",
|
||||||
)
|
)
|
||||||
|
|
||||||
async def set_profile_displayname(
|
async def set_profile_displayname(
|
||||||
|
|
|
@ -166,7 +166,7 @@ class ProfileTestCase(unittest.HomeserverTestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_incoming_fed_query(self) -> None:
|
def test_incoming_fed_query(self) -> None:
|
||||||
self.get_success(self.store.create_profile("caroline"))
|
self.get_success(self.store.create_profile("@caroline:test"))
|
||||||
self.get_success(self.store.set_profile_displayname("caroline", "Caroline"))
|
self.get_success(self.store.set_profile_displayname("caroline", "Caroline"))
|
||||||
|
|
||||||
response = self.get_success(
|
response = self.get_success(
|
||||||
|
|
|
@ -29,7 +29,7 @@ class DataStoreTestCase(unittest.HomeserverTestCase):
|
||||||
|
|
||||||
def test_get_users_paginate(self) -> None:
|
def test_get_users_paginate(self) -> None:
|
||||||
self.get_success(self.store.register_user(self.user.to_string(), "pass"))
|
self.get_success(self.store.register_user(self.user.to_string(), "pass"))
|
||||||
self.get_success(self.store.create_profile(self.user.localpart))
|
self.get_success(self.store.create_profile(self.user.to_string()))
|
||||||
self.get_success(
|
self.get_success(
|
||||||
self.store.set_profile_displayname(self.user.localpart, self.displayname)
|
self.store.set_profile_displayname(self.user.localpart, self.displayname)
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,7 +27,7 @@ class ProfileStoreTestCase(unittest.HomeserverTestCase):
|
||||||
self.u_frank = UserID.from_string("@frank:test")
|
self.u_frank = UserID.from_string("@frank:test")
|
||||||
|
|
||||||
def test_displayname(self) -> None:
|
def test_displayname(self) -> None:
|
||||||
self.get_success(self.store.create_profile(self.u_frank.localpart))
|
self.get_success(self.store.create_profile(self.u_frank.to_string()))
|
||||||
|
|
||||||
self.get_success(
|
self.get_success(
|
||||||
self.store.set_profile_displayname(self.u_frank.localpart, "Frank")
|
self.store.set_profile_displayname(self.u_frank.localpart, "Frank")
|
||||||
|
@ -54,7 +54,7 @@ class ProfileStoreTestCase(unittest.HomeserverTestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_avatar_url(self) -> None:
|
def test_avatar_url(self) -> None:
|
||||||
self.get_success(self.store.create_profile(self.u_frank.localpart))
|
self.get_success(self.store.create_profile(self.u_frank.to_string()))
|
||||||
|
|
||||||
self.get_success(
|
self.get_success(
|
||||||
self.store.set_profile_avatar_url(
|
self.store.set_profile_avatar_url(
|
||||||
|
|
Loading…
Reference in a new issue