Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Handle rejections of invites from local users locally #615
Conversation
richvdh
added some commits
Mar 1, 2016
richvdh
assigned
erikjohnston
Mar 1, 2016
|
See matrix-org/sytest#198 for test |
erikjohnston
and 2 others
commented on an outdated diff
Mar 2, 2016
| @@ -208,7 +207,18 @@ def _create_new_client_event(self, builder): | ||
| prev_member_event = yield self.store.get_room_member( | ||
| builder.sender, builder.room_id | ||
| ) | ||
| - if prev_member_event: | ||
| + | ||
| + # if we have the prev_member_event in context, we didn't receive | ||
| + # the invite over federation. (More likely is that the inviting | ||
| + # 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()) |
erikjohnston
Owner
|
|
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 :) |
erikjohnston
assigned
illicitonion
and unassigned
erikjohnston
Mar 2, 2016
illicitonion
and 1 other
commented on an outdated diff
Mar 2, 2016
| if not is_host_in_room: | ||
| - action = "remote_reject" | ||
| + # perhaps we've been invited | ||
| + inviter = self.get_inviter(target_user.to_string(), context.current_state) | ||
| + if not inviter: | ||
| + raise SynapseError(404, "Not a known room") | ||
| + | ||
| + if inviter.domain == self.server_name: |
richvdh
Member
|
illicitonion
and 1 other
commented on an outdated diff
Mar 2, 2016
| - action = "remote_reject" | ||
| + # perhaps we've been invited | ||
| + inviter = self.get_inviter(target_user.to_string(), context.current_state) | ||
| + if not inviter: | ||
| + raise SynapseError(404, "Not a known room") | ||
| + | ||
| + if inviter.domain == self.server_name: | ||
| + # the inviter was on our server, but has now left. Carry on | ||
| + # with the normal rejection codepath. | ||
| + # | ||
| + # This is a bit of a hack, because the room might still be | ||
| + # active on other servers. | ||
| + pass | ||
| + else: | ||
| + # send the rejection to the inviter's HS. | ||
| + remote_room_hosts = [inviter.domain] |
illicitonion
Contributor
|
|
LGTM, small handful of comments |
|
@illicitonion ptal? |
|
I generally favour this being the very first line of a function, so that it's obvious what's going on (because it's really compensating for the fact that default params are mutably stateful across invocations), and so that it doesn't matter what codepath you try to access/modify from |
|
LGTM, one minor comment |
richvdh
assigned
richvdh
and unassigned
illicitonion
Mar 2, 2016
|
retest this please |
|
retest this please |
|
retest this please pleeeease |
|
retest this please |
|
retest this please |
richvdh
added some commits
Mar 3, 2016
|
retest this please |
richvdh commentedMar 1, 2016
Slightly hacky fix to SYN-642, which avoids the federation codepath when trying
to reject invites from local users.