diff options
author | Mark Haines <mjark@negativecurvature.net> | 2017-01-04 15:39:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-04 15:39:31 +0000 |
commit | 0d766c8ccf619c0b95c8ed04b24b38aae61ea505 (patch) | |
tree | 4b38bcb09495c7ef9b815b8912f517c8be23a51f /synapse/federation/transaction_queue.py | |
parent | Bump version and changelog (diff) | |
parent | Get the destinations from the state from before the event (diff) | |
download | synapse-0d766c8ccf619c0b95c8ed04b24b38aae61ea505.tar.xz |
Merge pull request #1758 from matrix-org/markjh/fix_ban_propagation
Fix propagation of bans to remote servers.
Diffstat (limited to 'synapse/federation/transaction_queue.py')
-rw-r--r-- | synapse/federation/transaction_queue.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/synapse/federation/transaction_queue.py b/synapse/federation/transaction_queue.py index 51b656d74a..891c245bb4 100644 --- a/synapse/federation/transaction_queue.py +++ b/synapse/federation/transaction_queue.py @@ -19,7 +19,6 @@ from twisted.internet import defer from .persistence import TransactionActions from .units import Transaction, Edu -from synapse.api.constants import EventTypes, Membership from synapse.api.errors import HttpResponseException from synapse.util.async import run_on_reactor from synapse.util.logcontext import preserve_context_over_fn @@ -153,18 +152,22 @@ class TransactionQueue(object): break for event in events: + # Get the state from before the event. + # We need to make sure that this is the state from before + # the event and not from after it. + # Otherwise if the last member on a server in a room is + # banned then it won't receive the event because it won't + # be in the room after the ban. users_in_room = yield self.state.get_current_user_in_room( - event.room_id, latest_event_ids=[event.event_id], + event.room_id, latest_event_ids=[ + prev_id for prev_id, _ in event.prev_events + ], ) destinations = set( get_domain_from_id(user_id) for user_id in users_in_room ) - if event.type == EventTypes.Member: - if event.content["membership"] == Membership.JOIN: - destinations.add(get_domain_from_id(event.state_key)) - logger.debug("Sending %s to %r", event, destinations) self._send_pdu(event, destinations) |