summary refs log tree commit diff
path: root/synapse/handlers/profile.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-03-24 13:22:20 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-03-24 13:22:20 +0000
commitafc65ea972be20eeaec8a777eab79592894ba748 (patch)
treebce508ee1755ebf61e015d14d58b070861b8c57a /synapse/handlers/profile.py
parentStop returning aliases as part of the room list. (#6970) (diff)
parentChange displayname of user as admin in rooms (#6876) (diff)
downloadsynapse-afc65ea972be20eeaec8a777eab79592894ba748.tar.xz
Change displayname of user as admin in rooms (#6876)
* commit '7b0e2d961':
  Change displayname of user as admin in rooms (#6876)
Diffstat (limited to 'synapse/handlers/profile.py')
-rw-r--r--synapse/handlers/profile.py12
1 files changed, 11 insertions, 1 deletions
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
         )