Skip to content

Commit

Permalink
MSC4140: don't cancel delayed state on own state
Browse files Browse the repository at this point in the history
When a user sends a state event, do not cancel their own delayed events
for the same piece of state.
  • Loading branch information
AndrewFerr committed Oct 10, 2024
1 parent c246a09 commit 35cfaf2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/msc4140/delayed_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,20 +429,21 @@ func TestDelayedEvents(t *testing.T) {
})
})

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

stateKey := "to_be_cancelled_by_same_user"
stateKey := "to_not_be_cancelled_by_same_user"

defer cleanupDelayedEvents(t, user)

setterKey := "setter"
setterExpected := "on_timeout"
user.MustDo(
t,
"PUT",
getPathForState(roomID, eventType, stateKey),
client.WithJSONBody(t, map[string]interface{}{
setterKey: "on_timeout",
setterKey: setterExpected,
}),
getDelayQueryParam("900"),
)
Expand All @@ -453,19 +454,18 @@ func TestDelayedEvents(t *testing.T) {
},
})

setterExpected := "manual"
user.MustDo(
t,
"PUT",
getPathForState(roomID, eventType, stateKey),
client.WithJSONBody(t, map[string]interface{}{
setterKey: setterExpected,
setterKey: "manual",
}),
)
res = getDelayedEvents(t, user)
must.MatchResponse(t, res, match.HTTPResponse{
JSON: []match.JSON{
match.JSONKeyArrayOfSize("delayed_events", 0),
match.JSONKeyArrayOfSize("delayed_events", 1),
},
})

Expand All @@ -478,7 +478,7 @@ func TestDelayedEvents(t *testing.T) {
})
})

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

stateKey := "to_be_cancelled_by_other_user"
Expand Down

0 comments on commit 35cfaf2

Please sign in to comment.