mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-19 09:31:35 +03:00
Catch room profile errors and anything else that can go wrong
Fixes an issue where things become unhappy when the room profile for a user is missing.
This commit is contained in:
parent
b951f35572
commit
a527fbaae6
1 changed files with 28 additions and 25 deletions
|
@ -464,31 +464,34 @@ class RoomMemberHandler(object):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _send_merged_user_invites(self, requester, room_id):
|
def _send_merged_user_invites(self, requester, room_id):
|
||||||
profile_alias = "#_profile_" + requester.user.localpart + ":" + self.hs.hostname
|
try:
|
||||||
profile_alias = RoomAlias.from_string(profile_alias)
|
profile_alias = "#_profile_" + requester.user.localpart + ":" + self.hs.hostname
|
||||||
profile_room_id, remote_room_hosts = yield self.lookup_room_alias(profile_alias)
|
profile_alias = RoomAlias.from_string(profile_alias)
|
||||||
if profile_room_id:
|
profile_room_id, remote_room_hosts = yield self.lookup_room_alias(profile_alias)
|
||||||
linked_accounts = yield self.state_handler.get_current_state(
|
if profile_room_id:
|
||||||
room_id=profile_room_id.to_string(),
|
linked_accounts = yield self.state_handler.get_current_state(
|
||||||
event_type="m.linked_accounts",
|
room_id=profile_room_id.to_string(),
|
||||||
state_key="",
|
event_type="m.linked_accounts",
|
||||||
)
|
state_key="",
|
||||||
if not linked_accounts or not linked_accounts.content['all_children']:
|
)
|
||||||
return
|
if not linked_accounts or not linked_accounts.content['all_children']:
|
||||||
for child_id in linked_accounts.content['all_children']:
|
return
|
||||||
child = UserID.from_string(child_id)
|
for child_id in linked_accounts.content['all_children']:
|
||||||
if self.hs.is_mine(child) or child_id == requester.user.to_string():
|
child = UserID.from_string(child_id)
|
||||||
# TODO: Handle auto-invite for local users (not a priority)
|
if self.hs.is_mine(child) or child_id == requester.user.to_string():
|
||||||
continue
|
# TODO: Handle auto-invite for local users (not a priority)
|
||||||
try:
|
continue
|
||||||
yield self.update_membership(
|
try:
|
||||||
requester=requester,
|
yield self.update_membership(
|
||||||
target=child,
|
requester=requester,
|
||||||
room_id=room_id,
|
target=child,
|
||||||
action="invite",
|
room_id=room_id,
|
||||||
)
|
action="invite",
|
||||||
except Exception:
|
)
|
||||||
logger.exception("Failed to invite %s to %s" % (child_id, room_id))
|
except Exception:
|
||||||
|
logger.exception("Failed to invite %s to %s" % (child_id, room_id))
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Failed to send invites to children of %s in %s" % (requester.user.to_string(), room_id))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def send_membership_event(
|
def send_membership_event(
|
||||||
|
|
Loading…
Reference in a new issue