Remove user's avatar URL and displayname when deactivated. (#8932)

This only applies if the user's data is to be erased.
This commit is contained in:
Dirk Klimpel 2021-01-12 22:30:15 +01:00 committed by GitHub
parent 789d9ebad3
commit 7a2e9b549d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 351 additions and 17 deletions

View file

@ -286,13 +286,19 @@ class ProfileHandler(BaseHandler):
400, "Avatar URL is too long (max %i)" % (MAX_AVATAR_URL_LEN,)
)
avatar_url_to_set = new_avatar_url # type: Optional[str]
if new_avatar_url == "":
avatar_url_to_set = None
# Same like set_displayname
if by_admin:
requester = create_requester(
target_user, authenticated_entity=requester.authenticated_entity
)
await self.store.set_profile_avatar_url(target_user.localpart, new_avatar_url)
await self.store.set_profile_avatar_url(
target_user.localpart, avatar_url_to_set
)
if self.hs.config.user_directory_search_all_users:
profile = await self.store.get_profileinfo(target_user.localpart)