Use room version, not "hub_server" field when adding/validating "origin"
As other events sent in a LM room that are not on behalf of participating servers will not have this field.
This commit is contained in:
@@ -276,8 +276,9 @@ def create_local_event_from_event_dict(
|
||||
if format_version == EventFormatVersions.ROOM_V1_V2:
|
||||
event_dict["event_id"] = _create_event_id(clock, hostname)
|
||||
|
||||
if "hub_server" not in event_dict:
|
||||
# Do not add "origin" field to LPDUs.
|
||||
if not room_version.linearized_matrix:
|
||||
# Do not add "origin" field to events (LPDUs and PDUs) sent in
|
||||
# rooms that are meant to be compatible with linearized matrix.
|
||||
event_dict["origin"] = hostname
|
||||
|
||||
event_dict.setdefault("origin_server_ts", time_now)
|
||||
|
||||
@@ -66,8 +66,9 @@ class EventValidator:
|
||||
"type",
|
||||
]
|
||||
|
||||
if event.hub_server is not None:
|
||||
# Do not add the "origin" field to LPDUs.
|
||||
if event.room_version.linearized_matrix:
|
||||
# Do not add "origin" field to events (LPDUs and PDUs) sent in
|
||||
# rooms that are meant to be compatible with linearized matrix.
|
||||
required.remove("origin")
|
||||
|
||||
for k in required:
|
||||
|
||||
Reference in New Issue
Block a user