mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 06:53:09 -06:00
Add test for join/leave in the same /sync response
Add TODO to fix privacy leak
This commit is contained in:
parent
2f2a0d5940
commit
2cf37d1708
|
|
@ -572,6 +572,39 @@ func main() {
|
|||
}
|
||||
}`)
|
||||
|
||||
// Test joining and leaving the same room in a single /sync request puts the room in the 'leave' section.
|
||||
// TODO: Use an earlier since value to assert that the /sync response doesn't leak messages
|
||||
// from before charlie was joined to the room. Currently it does leak because RecentEvents doesn't
|
||||
// take membership into account.
|
||||
testSyncServer(syncServerCmdChan, "@charlie:localhost", "14", `{
|
||||
"account_data": {
|
||||
"events": []
|
||||
},
|
||||
"next_batch": "17",
|
||||
"presence": {
|
||||
"events": []
|
||||
},
|
||||
"rooms": {
|
||||
"invite": {},
|
||||
"join": {},
|
||||
"leave": {
|
||||
"!PjrbIMW2cIiaYF4t:localhost": {
|
||||
"state": {
|
||||
"events": []
|
||||
},
|
||||
"timeline": {
|
||||
"limited": false,
|
||||
"prev_batch": "",
|
||||
"events": [`+
|
||||
clientEventTestData[14]+","+
|
||||
clientEventTestData[15]+","+
|
||||
clientEventTestData[16]+`]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`)
|
||||
|
||||
// $ curl -XPUT -d '{"msgtype":"m.text","body":"why did you kick charlie"}' "http://localhost:8009/_matrix/client/r0/rooms/%21PjrbIMW2cIiaYF4t:localhost/send/m.room.message/3?access_token=@bob:localhost"
|
||||
// $ curl -XPUT -d '{"name":"No Charlies"}' "http://localhost:8009/_matrix/client/r0/rooms/%21PjrbIMW2cIiaYF4t:localhost/state/m.room.name?access_token=@alice:localhost"
|
||||
if err := exe.WriteToTopic(inputTopic, canonicalJSONInput(outputRoomEventTestData[17:19])); err != nil {
|
||||
|
|
|
|||
|
|
@ -148,6 +148,8 @@ func (d *SyncServerDatabase) IncrementalSync(userID string, fromPos, toPos types
|
|||
case "leave":
|
||||
fallthrough // transitions to leave are the same as ban
|
||||
case "ban":
|
||||
// TODO: recentEvents may contain events that this user is not allowed to see because they are
|
||||
// no longer in the room.
|
||||
lr := types.NewLeaveResponse()
|
||||
lr.Timeline.Events = gomatrixserverlib.ToClientEvents(recentEvents, gomatrixserverlib.FormatSync)
|
||||
lr.Timeline.Limited = false // TODO: if len(events) >= numRecents + 1 and then set limited:true
|
||||
|
|
|
|||
Loading…
Reference in a new issue