diff options
author | Erik Johnston <erik@matrix.org> | 2016-03-04 15:29:45 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-03-04 15:29:45 +0000 |
commit | 1a1abd8d05be59a38f8fcd1100a313739ff92627 (patch) | |
tree | e9a4d607a2caa8efc9610662900551e022e3b8a8 | |
parent | Merge pull request #598 from Rugvip/invite-state (diff) | |
parent | Spelling (diff) | |
download | synapse-1a1abd8d05be59a38f8fcd1100a313739ff92627.tar.xz |
Merge pull request #624 from matrix-org/erikj/invite_profile
Add profile information to invites
-rw-r--r-- | synapse/federation/federation_client.py | 2 | ||||
-rw-r--r-- | synapse/federation/transport/client.py | 1 | ||||
-rw-r--r-- | synapse/handlers/message.py | 17 |
3 files changed, 17 insertions, 3 deletions
diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py index e30e2da58d..83c1f46586 100644 --- a/synapse/federation/federation_client.py +++ b/synapse/federation/federation_client.py @@ -114,7 +114,7 @@ class FederationClient(FederationBase): @log_function def make_query(self, destination, query_type, args, - retry_on_dns_fail=True): + retry_on_dns_fail=False): """Sends a federation Query to a remote homeserver of the given type and arguments. diff --git a/synapse/federation/transport/client.py b/synapse/federation/transport/client.py index 2b5d40ea7f..2237e3413c 100644 --- a/synapse/federation/transport/client.py +++ b/synapse/federation/transport/client.py @@ -160,6 +160,7 @@ class TransportLayerClient(object): path=path, args=args, retry_on_dns_fail=retry_on_dns_fail, + timeout=10000, ) defer.returnValue(content) diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index cace1cb82a..e92c74d07b 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -196,12 +196,25 @@ class MessageHandler(BaseHandler): if builder.type == EventTypes.Member: membership = builder.content.get("membership", None) + target = UserID.from_string(builder.state_key) + if membership == Membership.JOIN: - joinee = UserID.from_string(builder.state_key) # If event doesn't include a display name, add one. yield collect_presencelike_data( - self.distributor, joinee, builder.content + self.distributor, target, builder.content ) + elif membership == Membership.INVITE: + profile = self.hs.get_handlers().profile_handler + content = builder.content + + try: + content["displayname"] = yield profile.get_displayname(target) + content["avatar_url"] = yield profile.get_avatar_url(target) + except Exception as e: + logger.info( + "Failed to get profile information for %r: %s", + target, e + ) if token_id is not None: builder.internal_metadata.token_id = token_id |