diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-12-01 20:53:04 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-12-01 20:53:04 +0000 |
commit | a9526831a45403d3da8165f7832cefc61282723c (patch) | |
tree | 15c28007a499e2baf93dd7c101f48a4909b14aa3 /synapse/handlers/profile.py | |
parent | Merge pull request #392 from matrix-org/markjh/client_config (diff) | |
download | synapse-a9526831a45403d3da8165f7832cefc61282723c.tar.xz |
Wrap calls to distributor.fire in appropriately named functions so that static analysis can work out want is calling what
Diffstat (limited to 'synapse/handlers/profile.py')
-rw-r--r-- | synapse/handlers/profile.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py index 799faffe53..576c6f09b4 100644 --- a/synapse/handlers/profile.py +++ b/synapse/handlers/profile.py @@ -28,6 +28,14 @@ import logging logger = logging.getLogger(__name__) +def changed_presencelike_data(distributor, user, state): + return distributor.fire("changed_presencelike_data", user, state) + + +def collect_presencelike_data(distributor, user, content): + return distributor.fire("collect_presencelike_data", user, content) + + class ProfileHandler(BaseHandler): def __init__(self, hs): @@ -95,11 +103,9 @@ class ProfileHandler(BaseHandler): target_user.localpart, new_displayname ) - yield self.distributor.fire( - "changed_presencelike_data", target_user, { - "displayname": new_displayname, - } - ) + yield changed_presencelike_data(self.distributor, target_user, { + "displayname": new_displayname, + }) yield self._update_join_states(target_user) @@ -144,11 +150,9 @@ class ProfileHandler(BaseHandler): target_user.localpart, new_avatar_url ) - yield self.distributor.fire( - "changed_presencelike_data", target_user, { - "avatar_url": new_avatar_url, - } - ) + yield changed_presencelike_data(self.distributor, target_user, { + "avatar_url": new_avatar_url, + }) yield self._update_join_states(target_user) @@ -208,9 +212,7 @@ class ProfileHandler(BaseHandler): "membership": Membership.JOIN, } - yield self.distributor.fire( - "collect_presencelike_data", user, content - ) + yield collect_presencelike_data(self.distributor, user, content) msg_handler = self.hs.get_handlers().message_handler try: |