Skip to content

Commit 1adbd54

Browse files
authored
MSC4140: don't cancel delayed state on own state (#768)
When a user sends a state event, do not cancel their own delayed events for the same piece of state.
1 parent 3fbfb75 commit 1adbd54

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/msc4140/delayed_event_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -372,35 +372,35 @@ func TestDelayedEvents(t *testing.T) {
372372
})
373373
})
374374

375-
t.Run("delayed state events are cancelled by a more recent state event from the same user", func(t *testing.T) {
375+
t.Run("delayed state is not cancelled by new state from the same user", func(t *testing.T) {
376376
var res *http.Response
377377

378-
stateKey := "to_be_cancelled_by_same_user"
378+
stateKey := "to_not_be_cancelled_by_same_user"
379379

380380
defer cleanupDelayedEvents(t, user)
381381

382382
setterKey := "setter"
383+
setterExpected := "on_timeout"
383384
user.MustDo(
384385
t,
385386
"PUT",
386387
getPathForState(roomID, eventType, stateKey),
387388
client.WithJSONBody(t, map[string]interface{}{
388-
setterKey: "on_timeout",
389+
setterKey: setterExpected,
389390
}),
390391
getDelayQueryParam("900"),
391392
)
392393
matchDelayedEvents(t, user, 1)
393394

394-
setterExpected := "manual"
395395
user.MustDo(
396396
t,
397397
"PUT",
398398
getPathForState(roomID, eventType, stateKey),
399399
client.WithJSONBody(t, map[string]interface{}{
400-
setterKey: setterExpected,
400+
setterKey: "manual",
401401
}),
402402
)
403-
matchDelayedEvents(t, user, 0)
403+
matchDelayedEvents(t, user, 1)
404404

405405
time.Sleep(1 * time.Second)
406406
res = user.MustDo(t, "GET", getPathForState(roomID, eventType, stateKey))
@@ -411,7 +411,7 @@ func TestDelayedEvents(t *testing.T) {
411411
})
412412
})
413413

414-
t.Run("delayed state events are cancelled by a more recent state event from another user", func(t *testing.T) {
414+
t.Run("delayed state is cancelled by new state from another user", func(t *testing.T) {
415415
var res *http.Response
416416

417417
stateKey := "to_be_cancelled_by_other_user"

0 commit comments

Comments
 (0)