@@ -30,16 +30,6 @@ const (
3030 DelayedEventActionSend = "send"
3131)
3232
33- // A filter for `/sync` that excludes timeline events.
34- //
35- // This is useful if you want to see `state` in the `/sync` response without the pesky
36- // de-duplication with `timeline` that traditional `/sync` does.
37- const NoTimelineSyncFilter = `{
38- "room": {
39- "timeline": { "limit": 0 }
40- }
41- }`
42-
4333// TODO: Test pagination of `GET /_matrix/client/v1/delayed_events` once
4434// it is implemented in a homeserver.
4535
@@ -195,7 +185,7 @@ func TestDelayedEvents(t *testing.T) {
195185
196186 // Check for the state change from the delayed state event (using `MustSyncUntil` to
197187 // account for any processing or worker replication delays)
198- user .MustSyncUntil (t , client.SyncReq {Filter : NoTimelineSyncFilter }, client .SyncStateHas (roomID , func (ev gjson.Result ) bool {
188+ user .MustSyncUntil (t , client.SyncReq {UseStateAfter : true }, client .SyncStateAfterHas (roomID , func (ev gjson.Result ) bool {
199189 return ev .Get ("type" ).Str == eventType && ev .Get ("state_key" ).Str == stateKey
200190 }))
201191 // Make sure the state looks as expected after
@@ -347,7 +337,7 @@ func TestDelayedEvents(t *testing.T) {
347337
348338 // Check for the state change from the delayed state event (using `MustSyncUntil` to
349339 // account for any processing or worker replication delays)
350- user .MustSyncUntil (t , client.SyncReq {Filter : NoTimelineSyncFilter }, client .SyncStateHas (roomID , func (ev gjson.Result ) bool {
340+ user .MustSyncUntil (t , client.SyncReq {UseStateAfter : true }, client .SyncStateAfterHas (roomID , func (ev gjson.Result ) bool {
351341 return ev .Get ("type" ).Str == eventType && ev .Get ("state_key" ).Str == stateKey
352342 }))
353343 // Make sure the state looks as expected after
@@ -417,7 +407,7 @@ func TestDelayedEvents(t *testing.T) {
417407
418408 // Check for the state change from the delayed state event (using `MustSyncUntil` to
419409 // account for any processing or worker replication delays)
420- user .MustSyncUntil (t , client.SyncReq {Filter : NoTimelineSyncFilter }, client .SyncStateHas (roomID , func (ev gjson.Result ) bool {
410+ user .MustSyncUntil (t , client.SyncReq {UseStateAfter : true }, client .SyncStateAfterHas (roomID , func (ev gjson.Result ) bool {
421411 return ev .Get ("type" ).Str == eventType && ev .Get ("state_key" ).Str == stateKey
422412 }))
423413 // Make sure the state looks as expected after
@@ -512,7 +502,7 @@ func TestDelayedEvents(t *testing.T) {
512502 // Sanity check that the room state was updated correctly with the delayed events
513503 // that were sent. (using `MustSyncUntil` to account for any processing or worker
514504 // replication delays)
515- user .MustSyncUntil (t , client.SyncReq {Filter : NoTimelineSyncFilter }, client .SyncStateHas (roomID , func (ev gjson.Result ) bool {
505+ user .MustSyncUntil (t , client.SyncReq {UseStateAfter : true }, client .SyncStateAfterHas (roomID , func (ev gjson.Result ) bool {
516506 return ev .Get ("type" ).Str == eventType && ev .Get ("state_key" ).Str == stateKey1
517507 }))
518508
@@ -528,7 +518,7 @@ func TestDelayedEvents(t *testing.T) {
528518 // FIXME: Ideally, we'd check specifically for the last one that was sent but it
529519 // will be a bit of a juggle and fiddly to get this right so for now we just check
530520 // one.
531- user .MustSyncUntil (t , client.SyncReq {Filter : NoTimelineSyncFilter }, client .SyncStateHas (roomID , func (ev gjson.Result ) bool {
521+ user .MustSyncUntil (t , client.SyncReq {UseStateAfter : true }, client .SyncStateAfterHas (roomID , func (ev gjson.Result ) bool {
532522 return ev .Get ("type" ).Str == eventType && ev .Get ("state_key" ).Str == stateKey2
533523 }))
534524 })
0 commit comments