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
|
|
@ -817,7 +817,7 @@ func (d *DatabaseTransaction) SelectMultiRoomData(ctx context.Context, r *types.
|
|||
}
|
||||
mr[row.UserId][row.Type] = types.MultiRoomData{
|
||||
Content: row.Data,
|
||||
Timestamp: row.Timestamp,
|
||||
OriginServerTs: row.Timestamp,
|
||||
}
|
||||
}
|
||||
return mr, nil
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ type MultiRoomContent []byte
|
|||
|
||||
type MultiRoomData struct {
|
||||
Content MultiRoomContent `json:"content"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
OriginServerTs int64 `json:"origin_server_ts"`
|
||||
}
|
||||
|
||||
func (d MultiRoomContent) MarshalJSON() ([]byte, error) {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ func TestMarshallMultiRoom(t *testing.T) {
|
|||
"@3:example.com": map[string]MultiRoomData{
|
||||
"location": {
|
||||
Content: MultiRoomContent(`{"foo":"bar"}`),
|
||||
Timestamp: 123,
|
||||
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