-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Handle rejections of invites from local users locally #615
Conversation
Slightly hacky fix to SYN-642, which avoids the federation codepath when trying to reject invites from local users.
See matrix-org/sytest#198 for test |
# user, and all other local users, have left, making | ||
# is_host_in_room return false). | ||
# | ||
context_events = (e.event_id for e in context.current_state.values()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused about this. The canonical check for if we received the invite over federation is if inviter.domain != self.server_name
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, but I guess here we're actually less interested in whether the event arrived over federation, and more in whether we already have it in context.current_state
. If the event is in context.current_state
despite being received over federation, there's no point dropping the context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the comment is unclear. If you're happy otherwise I could update the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, right, yes, it was mainly the comment that confused me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call this context_event_ids
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, and comment rewritten.
maybe @illicitonion should also take a look at this since he's been in the area recently. |
Looks ok to me, though I think @illicitonion should have a quick peek since I don't really know how any of this works anymore :) |
if not inviter: | ||
raise SynapseError(404, "Not a known room") | ||
|
||
if inviter.domain == self.server_name: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.hs.is_mine(inviter)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just lifted the code from do_remotely_reject_invite
. I guess your way is better
if anybody had bothered to document what self.hs actually is, this would have been somewhat easier to figure out.
LGTM, small handful of comments |
@illicitonion ptal? |
LGTM, one minor comment |
Also don't overwrite the list that gets passed in.
retest this please |
1 similar comment
retest this please |
retest this please pleeeease |
retest this please |
1 similar comment
retest this please |
retest this please |
Handle rejections of invites from local users locally
Slightly hacky fix to SYN-642, which avoids the federation codepath when trying
to reject invites from local users.