mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-10 23:53:09 -06:00
Be more spec compliant
This commit is contained in:
parent
920a20821b
commit
df2ca98e7e
|
|
@ -50,7 +50,7 @@ type messagesReq struct {
|
||||||
type messagesResp struct {
|
type messagesResp struct {
|
||||||
Start string `json:"start"`
|
Start string `json:"start"`
|
||||||
StartStream string `json:"start_stream,omitempty"` // NOTSPEC: used by Cerulean, so clients can hit /messages then immediately /sync with a latest sync token
|
StartStream string `json:"start_stream,omitempty"` // NOTSPEC: used by Cerulean, so clients can hit /messages then immediately /sync with a latest sync token
|
||||||
End string `json:"end"`
|
End string `json:"end,omitempty"`
|
||||||
Chunk []gomatrixserverlib.ClientEvent `json:"chunk"`
|
Chunk []gomatrixserverlib.ClientEvent `json:"chunk"`
|
||||||
State []gomatrixserverlib.ClientEvent `json:"state"`
|
State []gomatrixserverlib.ClientEvent `json:"state"`
|
||||||
}
|
}
|
||||||
|
|
@ -239,6 +239,12 @@ func OnIncomingMessagesRequest(
|
||||||
End: end.String(),
|
End: end.String(),
|
||||||
State: state,
|
State: state,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we didn't return any events, set the end to an empty string, so it will be omitted
|
||||||
|
// in the response JSON.
|
||||||
|
if len(res.Chunk) == 0 {
|
||||||
|
res.End = ""
|
||||||
|
}
|
||||||
if fromStream != nil {
|
if fromStream != nil {
|
||||||
res.StartStream = fromStream.String()
|
res.StartStream = fromStream.String()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue