mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-27 20:22:07 +03:00
Address review comments
This commit is contained in:
parent
05ea111c47
commit
9ff940a0ef
2 changed files with 17 additions and 8 deletions
|
@ -208,14 +208,22 @@ class BaseHandler(object):
|
||||||
builder.sender, builder.room_id
|
builder.sender, builder.room_id
|
||||||
)
|
)
|
||||||
|
|
||||||
# if we have the prev_member_event in context, we didn't receive
|
# The prev_member_event may already be in context.current_state,
|
||||||
# the invite over federation. (More likely is that the inviting
|
# despite us not being present in the room; in particular, if
|
||||||
# user, and all other local users, have left, making
|
# inviting user, and all other local users, have already left.
|
||||||
# is_host_in_room return false).
|
|
||||||
#
|
#
|
||||||
context_events = (e.event_id for e in context.current_state.values())
|
# In that case, we have all the information we need, and we don't
|
||||||
|
# want to drop "context" - not least because we may need to handle
|
||||||
|
# the invite locally, which will require us to have the whole
|
||||||
|
# context (not just prev_member_event) to auth it.
|
||||||
|
#
|
||||||
|
context_event_ids = (
|
||||||
|
e.event_id for e in context.current_state.values()
|
||||||
|
)
|
||||||
|
|
||||||
if prev_member_event and prev_member_event.event_id not in context_events:
|
if (prev_member_event and
|
||||||
|
prev_member_event.event_id not in context_event_ids
|
||||||
|
):
|
||||||
# The prev_member_event is missing from context, so it must
|
# The prev_member_event is missing from context, so it must
|
||||||
# have arrived over federation and is an outlier. We forcibly
|
# have arrived over federation and is an outlier. We forcibly
|
||||||
# set our context to the invite we received over federation
|
# set our context to the invite we received over federation
|
||||||
|
|
|
@ -528,7 +528,7 @@ class RoomMemberHandler(BaseHandler):
|
||||||
if not inviter:
|
if not inviter:
|
||||||
raise SynapseError(404, "Not a known room")
|
raise SynapseError(404, "Not a known room")
|
||||||
|
|
||||||
if inviter.domain == self.server_name:
|
if self.hs.is_mine(inviter):
|
||||||
# the inviter was on our server, but has now left. Carry on
|
# the inviter was on our server, but has now left. Carry on
|
||||||
# with the normal rejection codepath.
|
# with the normal rejection codepath.
|
||||||
#
|
#
|
||||||
|
@ -537,7 +537,8 @@ class RoomMemberHandler(BaseHandler):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
# send the rejection to the inviter's HS.
|
# send the rejection to the inviter's HS.
|
||||||
remote_room_hosts = [inviter.domain]
|
remote_room_hosts = remote_room_hosts or []
|
||||||
|
remote_room_hosts.append(inviter.domain)
|
||||||
action = "remote_reject"
|
action = "remote_reject"
|
||||||
|
|
||||||
federation_handler = self.hs.get_handlers().federation_handler
|
federation_handler = self.hs.get_handlers().federation_handler
|
||||||
|
|
Loading…
Reference in a new issue