diff options
author | Daniel Wagner-Hall <dawagner@gmail.com> | 2016-02-18 11:48:28 +0000 |
---|---|---|
committer | Daniel Wagner-Hall <dawagner@gmail.com> | 2016-02-18 11:48:28 +0000 |
commit | 35cda2e6927dabb0d9782c3181d1dbbea231c9e5 (patch) | |
tree | fee32bfdc6f723fd465c20e4842a19bdaca6e0af /synapse/handlers/profile.py | |
parent | Merge pull request #580 from Rugvip/develop (diff) | |
parent | Review comments (diff) | |
download | synapse-35cda2e6927dabb0d9782c3181d1dbbea231c9e5.tar.xz |
Merge pull request #583 from matrix-org/daniel/roomcleanupincremental
Merge all of the room membership codepaths into one
Diffstat (limited to 'synapse/handlers/profile.py')
-rw-r--r-- | synapse/handlers/profile.py | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py index 629e6e3594..f3e73d926e 100644 --- a/synapse/handlers/profile.py +++ b/synapse/handlers/profile.py @@ -16,8 +16,7 @@ from twisted.internet import defer from synapse.api.errors import SynapseError, AuthError, CodeMessageException -from synapse.api.constants import EventTypes, Membership -from synapse.types import UserID +from synapse.types import UserID, Requester from synapse.util import unwrapFirstError from ._base import BaseHandler @@ -208,21 +207,18 @@ class ProfileHandler(BaseHandler): ) for j in joins: - content = { - "membership": Membership.JOIN, - } - - yield collect_presencelike_data(self.distributor, user, content) - - msg_handler = self.hs.get_handlers().message_handler + handler = self.hs.get_handlers().room_member_handler try: - yield msg_handler.create_and_send_event({ - "type": EventTypes.Member, - "room_id": j.room_id, - "state_key": user.to_string(), - "content": content, - "sender": user.to_string() - }, ratelimit=False) + # Assume the user isn't a guest because we don't let guests set + # profile or avatar data. + requester = Requester(user, "", False) + yield handler.update_membership( + requester, + user, + j.room_id, + "join", # We treat a profile update like a join. + ratelimit=False, # Try to hide that these events aren't atomic. + ) except Exception as e: logger.warn( "Failed to update join event for room %s - %s", |