Skip to content

Commit

Permalink
support matrix-synapse (> 1.57.1) no longer returning end for room_…
Browse files Browse the repository at this point in the history
…messages if no additional pages exist
  • Loading branch information
herb authored and poljar committed Sep 13, 2022
1 parent 4ce1bcb commit 9acf5ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions nio/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ class RoomMessagesResponse(Response):

chunk: List[Union[Event, BadEventType]] = field()
start: str = field()
end: str = field()
end: str = field(default=None)

@classmethod
@verify(Schemas.room_messages, RoomMessagesError)
Expand All @@ -1216,7 +1216,7 @@ def from_dict(
# type: (...) -> Union[RoomMessagesResponse, ErrorResponse]
chunk: List[Union[Event, BadEventType]] = []
chunk = SyncResponse._get_room_events(parsed_dict["chunk"])
return cls(room_id, chunk, parsed_dict["start"], parsed_dict["end"])
return cls(room_id, chunk, parsed_dict["start"], parsed_dict.get("end"))


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion nio/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ class Schemas:
"start": {"type": "string"},
"end": {"type": "string"},
},
"required": ["chunk", "start", "end"],
"required": ["chunk", "start"],
}

room_context = {
Expand Down

0 comments on commit 9acf5ed

Please sign in to comment.