mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-09-08 05:11:59 +00:00
Correctly send ratelimit and extra_users params
This commit is contained in:
parent
f756f961ea
commit
6b8604239f
@ -583,6 +583,8 @@ class EventCreationHandler(object):
|
|||||||
requester=requester,
|
requester=requester,
|
||||||
event=event,
|
event=event,
|
||||||
context=context,
|
context=context,
|
||||||
|
ratelimit=ratelimit,
|
||||||
|
extra_users=extra_users,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -29,7 +29,8 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def send_event_to_master(client, host, port, requester, event, context):
|
def send_event_to_master(client, host, port, requester, event, context,
|
||||||
|
ratelimit, extra_users):
|
||||||
"""Send event to be handled on the master
|
"""Send event to be handled on the master
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -39,6 +40,8 @@ def send_event_to_master(client, host, port, requester, event, context):
|
|||||||
requester (Requester)
|
requester (Requester)
|
||||||
event (FrozenEvent)
|
event (FrozenEvent)
|
||||||
context (EventContext)
|
context (EventContext)
|
||||||
|
ratelimit (bool)
|
||||||
|
extra_users (list(str)): Any extra users to notify about event
|
||||||
"""
|
"""
|
||||||
uri = "http://%s:%s/_synapse/replication/send_event" % (host, port,)
|
uri = "http://%s:%s/_synapse/replication/send_event" % (host, port,)
|
||||||
|
|
||||||
@ -48,6 +51,8 @@ def send_event_to_master(client, host, port, requester, event, context):
|
|||||||
"rejected_reason": event.rejected_reason,
|
"rejected_reason": event.rejected_reason,
|
||||||
"context": context.serialize(event),
|
"context": context.serialize(event),
|
||||||
"requester": requester.serialize(),
|
"requester": requester.serialize(),
|
||||||
|
"ratelimit": ratelimit,
|
||||||
|
"extra_users": extra_users,
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -74,6 +79,8 @@ class ReplicationSendEventRestServlet(RestServlet):
|
|||||||
"rejected_reason": .., // The event.rejected_reason field
|
"rejected_reason": .., // The event.rejected_reason field
|
||||||
"context": { .. serialized event context .. },
|
"context": { .. serialized event context .. },
|
||||||
"requester": { .. serialized requester .. },
|
"requester": { .. serialized requester .. },
|
||||||
|
"ratelimit": true,
|
||||||
|
"extra_users": [],
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
PATTERNS = [re.compile("^/_synapse/replication/send_event$")]
|
PATTERNS = [re.compile("^/_synapse/replication/send_event$")]
|
||||||
@ -98,6 +105,9 @@ class ReplicationSendEventRestServlet(RestServlet):
|
|||||||
requester = Requester.deserialize(self.store, content["requester"])
|
requester = Requester.deserialize(self.store, content["requester"])
|
||||||
context = yield EventContext.deserialize(self.store, content["context"])
|
context = yield EventContext.deserialize(self.store, content["context"])
|
||||||
|
|
||||||
|
ratelimit = content["ratelimit"]
|
||||||
|
extra_users = content["extra_users"]
|
||||||
|
|
||||||
if requester.user:
|
if requester.user:
|
||||||
request.authenticated_entity = requester.user.to_string()
|
request.authenticated_entity = requester.user.to_string()
|
||||||
|
|
||||||
@ -108,6 +118,8 @@ class ReplicationSendEventRestServlet(RestServlet):
|
|||||||
|
|
||||||
yield self.event_creation_handler.persist_and_notify_client_event(
|
yield self.event_creation_handler.persist_and_notify_client_event(
|
||||||
requester, event, context,
|
requester, event, context,
|
||||||
|
ratelimit=ratelimit,
|
||||||
|
extra_users=extra_users,
|
||||||
)
|
)
|
||||||
|
|
||||||
defer.returnValue((200, {}))
|
defer.returnValue((200, {}))
|
||||||
|
Loading…
Reference in New Issue
Block a user