mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 06:53:09 -06:00
Merge pull request #67 from globekeeper/daniel/origin_server_ts
♻️ Use origin_server_ts instead of timestamp in MR /sync responses.
This commit is contained in:
commit
beeb0ca8f5
|
|
@ -816,8 +816,8 @@ func (d *DatabaseTransaction) SelectMultiRoomData(ctx context.Context, r *types.
|
|||
mr[row.UserId] = make(map[string]types.MultiRoomData)
|
||||
}
|
||||
mr[row.UserId][row.Type] = types.MultiRoomData{
|
||||
Content: row.Data,
|
||||
Timestamp: row.Timestamp,
|
||||
Content: row.Data,
|
||||
OriginServerTs: row.Timestamp,
|
||||
}
|
||||
}
|
||||
return mr, nil
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ type MultiRoom map[string]map[string]MultiRoomData
|
|||
type MultiRoomContent []byte
|
||||
|
||||
type MultiRoomData struct {
|
||||
Content MultiRoomContent `json:"content"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Content MultiRoomContent `json:"content"`
|
||||
OriginServerTs int64 `json:"origin_server_ts"`
|
||||
}
|
||||
|
||||
func (d MultiRoomContent) MarshalJSON() ([]byte, error) {
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ func TestMarshallMultiRoom(t *testing.T) {
|
|||
MultiRoom{
|
||||
"@3:example.com": map[string]MultiRoomData{
|
||||
"location": {
|
||||
Content: MultiRoomContent(`{"foo":"bar"}`),
|
||||
Timestamp: 123,
|
||||
Content: MultiRoomContent(`{"foo":"bar"}`),
|
||||
OriginServerTs: 123,
|
||||
}}})
|
||||
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"},"origin_server_ts":123}}}`))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue