Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSC4140: don't cancel delayed state on own state #742

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading