summary refs log tree commit diff
path: root/synapse/handlers/profile.py
diff options
context:
space:
mode:
authorDirk Klimpel <5740567+dklimpel@users.noreply.github.com>2021-01-12 22:30:15 +0100
committerGitHub <noreply@github.com>2021-01-12 16:30:15 -0500
commit7a2e9b549defe3f55531711a863183a33e7af83c (patch)
tree1ceeb3a73fd7a8cfa16fca79632bbb0ce554b0bc /synapse/handlers/profile.py
parentUI Auth via SSO: redirect the user to an appropriate SSO. (#9081) (diff)
downloadsynapse-7a2e9b549defe3f55531711a863183a33e7af83c.tar.xz
Remove user's avatar URL and displayname when deactivated. (#8932)
This only applies if the user's data is to be erased.
Diffstat (limited to 'synapse/handlers/profile.py')
-rw-r--r--synapse/handlers/profile.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py
index 36f9ee4b71..c02b951031 100644
--- a/synapse/handlers/profile.py
+++ b/synapse/handlers/profile.py
@@ -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)