mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-19 09:31:35 +03:00
Attempt 2 at fixing
Attempt 1 didn't work because the remote server isn't expecting to receive a `leave` negotiation. Instead, we should try sending the event over a transaction so that the remote can deal with it as it would any other leave event.
This commit is contained in:
parent
89b5876a00
commit
88df3a43e1
1 changed files with 13 additions and 0 deletions
|
@ -22,6 +22,7 @@ from prometheus_client import Counter
|
|||
from twisted.internet import defer
|
||||
|
||||
import synapse.metrics
|
||||
from synapse.api.constants import EventTypes, Membership
|
||||
from synapse.api.errors import (
|
||||
FederationDeniedError,
|
||||
HttpResponseException,
|
||||
|
@ -36,6 +37,7 @@ from synapse.metrics import (
|
|||
sent_transactions_counter,
|
||||
)
|
||||
from synapse.metrics.background_process_metrics import run_as_background_process
|
||||
from synapse.types import UserID
|
||||
from synapse.util import logcontext
|
||||
from synapse.util.metrics import measure_func
|
||||
from synapse.util.retryutils import NotRetryingDestination, get_retry_limiter
|
||||
|
@ -202,6 +204,17 @@ class TransactionQueue(object):
|
|||
destinations = yield self.state.get_current_hosts_in_room(
|
||||
event.room_id, latest_event_ids=event.prev_event_ids(),
|
||||
)
|
||||
|
||||
# Special case leaves: We could be disinviting the host or
|
||||
# unbanning them, so send the event to the host if they are
|
||||
# not already in the list. The event affects their membership,
|
||||
# so they have a moderate right to know what's going on.
|
||||
if event.type == EventTypes.Member and (event.membership ==
|
||||
Membership.LEAVE):
|
||||
target_user = UserID.from_string(event.state_key)
|
||||
if target_user.domain not in destinations:
|
||||
destinations = set(destinations)
|
||||
destinations.add(target_user.domain)
|
||||
except Exception:
|
||||
logger.exception(
|
||||
"Failed to calculate hosts in room for event: %s",
|
||||
|
|
Loading…
Reference in a new issue