From bf900538b8835a97af066cbfa084dbcf566762cd Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 2 Feb 2021 02:44:01 -0600 Subject: [PATCH] Remove origin_server_ts in favor of spec'ed ts query param Also edits for TARDIS visualation: https://github.com/matrix-org/tardis/pull/1 --- synapse/events/utils.py | 14 +++++++------- synapse/rest/client/v1/room.py | 10 +--------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/synapse/events/utils.py b/synapse/events/utils.py index 9c22e3381378..2b238f2d75fb 100644 --- a/synapse/events/utils.py +++ b/synapse/events/utils.py @@ -250,13 +250,13 @@ def format_event_for_client_v1(d): def format_event_for_client_v2(d): drop_keys = ( - "auth_events", - "prev_events", - "hashes", - "signatures", - "depth", - "origin", - "prev_state", + # "auth_events", + # "prev_events", + # "hashes", + # "signatures", + # "depth", + # "origin", + # "prev_state", ) for key in drop_keys: d.pop(key, None) diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py index 0116dcd3f6b6..2770a73b26a5 100644 --- a/synapse/rest/client/v1/room.py +++ b/synapse/rest/client/v1/room.py @@ -225,7 +225,6 @@ async def on_POST(self, request, room_id, event_type, txn_id=None): requester = await self.auth.get_user_by_req(request, allow_guest=True) content = parse_json_object_from_request(request) prev_events = parse_strings_from_args(request.args, "prev_event") - origin_server_ts = parse_integer(request, "origin_server_ts") event_dict = { "type": event_type, @@ -237,14 +236,7 @@ async def on_POST(self, request, room_id, event_type, txn_id=None): if prev_events: event_dict["prev_events"] = prev_events - # TODO: Add `and requester.app_service` - if origin_server_ts: - event_dict["origin_server_ts"] = origin_server_ts - - # TODO: I noticed in the Synapse code that we already accept a `ts` query parameter to override - # the `origin_server_ts` if the request is coming from an app service. - # Do we want to remove in favor of the spec'ed code above - if b"ts" in request.args and requester.app_service: + if b"ts" in request.args: # and requester.app_service: event_dict["origin_server_ts"] = parse_integer(request, "ts", 0) try: