Support disabling setting displayname/avatar url

This commit is contained in:
Tulir Asokan 2019-08-31 11:53:30 +03:00
parent cbe312176d
commit d5541caf8d

View File

@ -200,12 +200,14 @@ class Client:
if displayname is None or displayname == self.displayname: if displayname is None or displayname == self.displayname:
return return
self.db_instance.displayname = displayname self.db_instance.displayname = displayname
if self.displayname != "disable":
await self.client.set_displayname(self.displayname) await self.client.set_displayname(self.displayname)
async def update_avatar_url(self, avatar_url: ContentURI) -> None: async def update_avatar_url(self, avatar_url: ContentURI) -> None:
if avatar_url is None or avatar_url == self.avatar_url: if avatar_url is None or avatar_url == self.avatar_url:
return return
self.db_instance.avatar_url = avatar_url self.db_instance.avatar_url = avatar_url
if self.avatar_url != "disable":
await self.client.set_avatar_url(self.avatar_url) await self.client.set_avatar_url(self.avatar_url)
async def update_access_details(self, access_token: str, homeserver: str) -> None: async def update_access_details(self, access_token: str, homeserver: str) -> None: