mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-06 22:43:10 -06:00
♻️ Use origin_server_ts instead of timestamp in MR /sync responses.
This commit is contained in:
parent
bf0f05b8fe
commit
129fc42c0b
|
|
@ -816,8 +816,8 @@ func (d *DatabaseTransaction) SelectMultiRoomData(ctx context.Context, r *types.
|
||||||
mr[row.UserId] = make(map[string]types.MultiRoomData)
|
mr[row.UserId] = make(map[string]types.MultiRoomData)
|
||||||
}
|
}
|
||||||
mr[row.UserId][row.Type] = types.MultiRoomData{
|
mr[row.UserId][row.Type] = types.MultiRoomData{
|
||||||
Content: row.Data,
|
Content: row.Data,
|
||||||
Timestamp: row.Timestamp,
|
OriginServerTs: row.Timestamp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mr, nil
|
return mr, nil
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ type MultiRoom map[string]map[string]MultiRoomData
|
||||||
type MultiRoomContent []byte
|
type MultiRoomContent []byte
|
||||||
|
|
||||||
type MultiRoomData struct {
|
type MultiRoomData struct {
|
||||||
Content MultiRoomContent `json:"content"`
|
Content MultiRoomContent `json:"content"`
|
||||||
Timestamp int64 `json:"timestamp"`
|
OriginServerTs int64 `json:"origin_server_ts"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d MultiRoomContent) MarshalJSON() ([]byte, error) {
|
func (d MultiRoomContent) MarshalJSON() ([]byte, error) {
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ func TestMarshallMultiRoom(t *testing.T) {
|
||||||
MultiRoom{
|
MultiRoom{
|
||||||
"@3:example.com": map[string]MultiRoomData{
|
"@3:example.com": map[string]MultiRoomData{
|
||||||
"location": {
|
"location": {
|
||||||
Content: MultiRoomContent(`{"foo":"bar"}`),
|
Content: MultiRoomContent(`{"foo":"bar"}`),
|
||||||
Timestamp: 123,
|
OriginServerTs: 123,
|
||||||
}}})
|
}}})
|
||||||
is.NoErr(err)
|
is.NoErr(err)
|
||||||
is.Equal(m, []byte(`{"@3:example.com":{"location":{"content":{"foo":"bar"},"timestamp":123}}}`))
|
is.Equal(m, []byte(`{"@3:example.com":{"location":{"content":{"foo":"bar"},"timestamp":123}}}`))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue