mirror of
https://github.com/element-hq/synapse
synced 2024-08-19 05:40:58 +00:00
Fix for issue 2635: correctly update rooms avatar/display name when modified by admin
This commit is contained in:
parent
632baf799e
commit
fa4f337b49
1 changed files with 8 additions and 12 deletions
|
@ -140,7 +140,7 @@ class ProfileHandler(BaseHandler):
|
||||||
target_user.localpart, new_displayname
|
target_user.localpart, new_displayname
|
||||||
)
|
)
|
||||||
|
|
||||||
yield self._update_join_states(requester)
|
yield self._update_join_states(requester, target_user)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_avatar_url(self, target_user):
|
def get_avatar_url(self, target_user):
|
||||||
|
@ -184,7 +184,7 @@ class ProfileHandler(BaseHandler):
|
||||||
target_user.localpart, new_avatar_url
|
target_user.localpart, new_avatar_url
|
||||||
)
|
)
|
||||||
|
|
||||||
yield self._update_join_states(requester)
|
yield self._update_join_states(requester, target_user)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def on_profile_query(self, args):
|
def on_profile_query(self, args):
|
||||||
|
@ -209,28 +209,24 @@ class ProfileHandler(BaseHandler):
|
||||||
defer.returnValue(response)
|
defer.returnValue(response)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _update_join_states(self, requester):
|
def _update_join_states(self, requester, target_user):
|
||||||
user = requester.user
|
if not self.hs.is_mine(target_user):
|
||||||
if not self.hs.is_mine(user):
|
|
||||||
return
|
return
|
||||||
|
|
||||||
yield self.ratelimit(requester)
|
yield self.ratelimit(requester)
|
||||||
|
|
||||||
room_ids = yield self.store.get_rooms_for_user(
|
room_ids = yield self.store.get_rooms_for_user(
|
||||||
user.to_string(),
|
target_user.to_string(),
|
||||||
)
|
)
|
||||||
|
|
||||||
for room_id in room_ids:
|
for room_id in room_ids:
|
||||||
handler = self.hs.get_handlers().room_member_handler
|
handler = self.hs.get_handlers().room_member_handler
|
||||||
try:
|
try:
|
||||||
# Assume the user isn't a guest because we don't let guests set
|
# Assume the target_user isn't a guest,
|
||||||
# profile or avatar data.
|
# 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)
|
|
||||||
yield handler.update_membership(
|
yield handler.update_membership(
|
||||||
requester,
|
requester,
|
||||||
user,
|
target_user,
|
||||||
room_id,
|
room_id,
|
||||||
"join", # We treat a profile update like a join.
|
"join", # We treat a profile update like a join.
|
||||||
ratelimit=False, # Try to hide that these events aren't atomic.
|
ratelimit=False, # Try to hide that these events aren't atomic.
|
||||||
|
|
Loading…
Reference in a new issue