diff options
author | Eric Eastwood <erice@element.io> | 2022-07-05 05:56:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-05 05:56:06 -0500 |
commit | 2c2a42cc107fb02bbf7c8d4e6141cbe601221629 (patch) | |
tree | 028131a8de41d3b849be64cec2347e59f23044ef | |
parent | Add the ability to set the log level using the `SYNAPSE_TEST_LOG_LEVEL` envir... (diff) | |
download | synapse-2c2a42cc107fb02bbf7c8d4e6141cbe601221629.tar.xz |
Fix application service not being able to join remote federated room without a profile set (#13131)
Fix https://github.com/matrix-org/synapse/issues/4778 Complement tests: https://github.com/matrix-org/complement/pull/399
Diffstat (limited to '')
-rw-r--r-- | changelog.d/13131.bugfix | 1 | ||||
-rw-r--r-- | synapse/handlers/room_member.py | 32 |
2 files changed, 24 insertions, 9 deletions
diff --git a/changelog.d/13131.bugfix b/changelog.d/13131.bugfix new file mode 100644 index 0000000000..06602f03fe --- /dev/null +++ b/changelog.d/13131.bugfix @@ -0,0 +1 @@ +Fix application service not being able to join remote federated room without a profile set. diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py index 5648ab4bf4..a1d8875dd8 100644 --- a/synapse/handlers/room_member.py +++ b/synapse/handlers/room_member.py @@ -846,10 +846,17 @@ class RoomMemberHandler(metaclass=abc.ABCMeta): content["membership"] = Membership.JOIN - profile = self.profile_handler - if not content_specified: - content["displayname"] = await profile.get_displayname(target) - content["avatar_url"] = await profile.get_avatar_url(target) + try: + profile = self.profile_handler + if not content_specified: + content["displayname"] = await profile.get_displayname(target) + content["avatar_url"] = await profile.get_avatar_url(target) + except Exception as e: + logger.info( + "Failed to get profile information while processing remote join for %r: %s", + target, + e, + ) if requester.is_guest: content["kind"] = "guest" @@ -926,11 +933,18 @@ class RoomMemberHandler(metaclass=abc.ABCMeta): content["membership"] = Membership.KNOCK - profile = self.profile_handler - if "displayname" not in content: - content["displayname"] = await profile.get_displayname(target) - if "avatar_url" not in content: - content["avatar_url"] = await profile.get_avatar_url(target) + try: + profile = self.profile_handler + if "displayname" not in content: + content["displayname"] = await profile.get_displayname(target) + if "avatar_url" not in content: + content["avatar_url"] = await profile.get_avatar_url(target) + except Exception as e: + logger.info( + "Failed to get profile information while processing remote knock for %r: %s", + target, + e, + ) return await self.remote_knock( remote_room_hosts, room_id, target, content |