diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2020-03-24 13:22:20 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2020-03-24 13:22:20 +0000 |
commit | afc65ea972be20eeaec8a777eab79592894ba748 (patch) | |
tree | bce508ee1755ebf61e015d14d58b070861b8c57a | |
parent | Stop returning aliases as part of the room list. (#6970) (diff) | |
parent | Change displayname of user as admin in rooms (#6876) (diff) | |
download | synapse-afc65ea972be20eeaec8a777eab79592894ba748.tar.xz |
Change displayname of user as admin in rooms (#6876)
* commit '7b0e2d961': Change displayname of user as admin in rooms (#6876)
-rw-r--r-- | changelog.d/6572.bugfix | 1 | ||||
-rw-r--r-- | synapse/handlers/profile.py | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/changelog.d/6572.bugfix b/changelog.d/6572.bugfix new file mode 100644 index 0000000000..4f708f409f --- /dev/null +++ b/changelog.d/6572.bugfix @@ -0,0 +1 @@ +When a user's profile is updated via the admin API, also generate a displayname/avatar update for that user in each room. diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py index 75227ae34b..824fadf028 100644 --- a/synapse/handlers/profile.py +++ b/synapse/handlers/profile.py @@ -33,7 +33,7 @@ from synapse.api.errors import ( ) from synapse.logging.context import run_in_background 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 @@ -268,6 +268,12 @@ class BaseProfileHandler(BaseHandler): else: new_batchnum = 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, new_batchnum ) @@ -399,6 +405,10 @@ class BaseProfileHandler(BaseHandler): 400, "Avatar file type '%s' not allowed" % media_info["media_type"] ) + # 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, new_batchnum ) |