summary refs log tree commit diff
path: root/synapse/handlers/profile.py
diff options
context:
space:
mode:
authorFrancois Granade <github.com@farialima.net>2017-11-03 18:25:04 +0100
committerFrancois Granade <github.com@farialima.net>2017-11-03 18:25:04 +0100
commitfa4f337b49b9a417cbb3a555cd959b1be36cc666 (patch)
tree3a0c389b159cb231e521fa6c4af79978b8d6185e /synapse/handlers/profile.py
parentMerge pull request #2598 from matrix-org/revert-2596-erikj/attestation_jitter (diff)
downloadsynapse-fa4f337b49b9a417cbb3a555cd959b1be36cc666.tar.xz
Fix for issue 2635: correctly update rooms avatar/display name when modified by admin
Diffstat (limited to '')
-rw-r--r--synapse/handlers/profile.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py
index 62b9bd503e..d6646825d8 100644
--- a/synapse/handlers/profile.py
+++ b/synapse/handlers/profile.py
@@ -140,7 +140,7 @@ class ProfileHandler(BaseHandler):
             target_user.localpart, new_displayname
         )
 
-        yield self._update_join_states(requester)
+        yield self._update_join_states(requester, target_user)
 
     @defer.inlineCallbacks
     def get_avatar_url(self, target_user):
@@ -184,7 +184,7 @@ class ProfileHandler(BaseHandler):
             target_user.localpart, new_avatar_url
         )
 
-        yield self._update_join_states(requester)
+        yield self._update_join_states(requester, target_user)
 
     @defer.inlineCallbacks
     def on_profile_query(self, args):
@@ -209,28 +209,24 @@ class ProfileHandler(BaseHandler):
         defer.returnValue(response)
 
     @defer.inlineCallbacks
-    def _update_join_states(self, requester):
-        user = requester.user
-        if not self.hs.is_mine(user):
+    def _update_join_states(self, requester, target_user):
+        if not self.hs.is_mine(target_user):
             return
 
         yield self.ratelimit(requester)
 
         room_ids = yield self.store.get_rooms_for_user(
-            user.to_string(),
+            target_user.to_string(),
         )
 
         for room_id in room_ids:
             handler = self.hs.get_handlers().room_member_handler
             try:
-                # Assume the user isn't a guest because we don't let guests set
-                # profile or avatar data.
-                # XXX why are we recreating `requester` here for each room?
-                # what was wrong with the `requester` we were passed?
-                requester = synapse.types.create_requester(user)
+                # Assume the target_user isn't a guest,
+                # because we don't let guests set profile or avatar data.
                 yield handler.update_membership(
                     requester,
-                    user,
+                    target_user,
                     room_id,
                     "join",  # We treat a profile update like a join.
                     ratelimit=False,  # Try to hide that these events aren't atomic.