diff options
author | Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> | 2020-02-21 18:44:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-21 17:44:03 +0000 |
commit | 7b0e2d961ce9b70ed2d41f27f624ab752af26400 (patch) | |
tree | 70867ed7325074eac0a643f2afc47da3abb26ebe /synapse/handlers | |
parent | Stop returning aliases as part of the room list. (#6970) (diff) | |
download | synapse-7b0e2d961ce9b70ed2d41f27f624ab752af26400.tar.xz |
Change displayname of user as admin in rooms (#6876)
Diffstat (limited to '')
-rw-r--r-- | synapse/handlers/profile.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py index f9579d69ee..50ce0c585b 100644 --- a/synapse/handlers/profile.py +++ b/synapse/handlers/profile.py @@ -28,7 +28,7 @@ from synapse.api.errors import ( SynapseError, ) from synapse.metrics.background_process_metrics import run_as_background_process -from synapse.types import UserID, get_domain_from_id +from synapse.types import UserID, create_requester, get_domain_from_id from ._base import BaseHandler @@ -165,6 +165,12 @@ class BaseProfileHandler(BaseHandler): if new_displayname == "": new_displayname = None + # If the admin changes the display name of a user, the requesting user cannot send + # the join event to update the displayname in the rooms. + # This must be done by the target user himself. + if by_admin: + requester = create_requester(target_user) + yield self.store.set_profile_displayname(target_user.localpart, new_displayname) if self.hs.config.user_directory_search_all_users: @@ -217,6 +223,10 @@ class BaseProfileHandler(BaseHandler): 400, "Avatar URL is too long (max %i)" % (MAX_AVATAR_URL_LEN,) ) + # Same like set_displayname + if by_admin: + requester = create_requester(target_user) + yield self.store.set_profile_avatar_url(target_user.localpart, new_avatar_url) if self.hs.config.user_directory_search_all_users: |