diff --git a/tests/csapi/thread_notifications_test.go b/tests/csapi/thread_notifications_test.go index 9ed2f250..c5fc767f 100644 --- a/tests/csapi/thread_notifications_test.go +++ b/tests/csapi/thread_notifications_test.go @@ -303,8 +303,8 @@ func TestThreadedReceipts(t *testing.T) { } // Regression test for https://github.com/matrix-org/matrix-spec/issues/1727 -// Servers need to send 2x EDUs to represent these 2 receipts, but do they? -func TestThreadReceiptsInSync(t *testing.T) { +// Servers should always prefer the unthreaded receipt when there is a clash of receipts +func TestThreadReceiptsInSyncMSC4102(t *testing.T) { runtime.SkipIf(t, runtime.Dendrite) // not supported deployment := complement.Deploy(t, 1) defer deployment.Destroy(t) @@ -330,38 +330,15 @@ func TestThreadReceiptsInSync(t *testing.T) { }, }, }) - // now send an unthreaded RR for event B and a threaded RR for event B and ensure we see both receipts + // now send an unthreaded RR for event B and a threaded RR for event B and ensure we see the unthreaded RR // down /sync. Non-compliant servers will typically send the last one only. alice.MustDo(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "receipt", "m.read", eventB}, client.WithJSONBody(t, struct{}{})) alice.MustDo(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "receipt", "m.read", eventB}, client.WithJSONBody(t, map[string]interface{}{"thread_id": eventA})) - seenThreaded := false - seenUnthreaded := false - alice.MustSyncUntil( t, client.SyncReq{}, - // we need to allow multiple /sync responses to gradually show us both receipts, hence the weird shape here. - func(clientUserID string, topLevelSyncJSON gjson.Result) error { - var lastErr error - if err := syncHasUnthreadedReadReceipt(roomID, alice.UserID, eventB)(clientUserID, topLevelSyncJSON); err == nil { - seenUnthreaded = true - t.Logf("seen unthreaded read receipt") - } else { - lastErr = err - } - if err := syncHasThreadedReadReceipt(roomID, alice.UserID, eventB, eventA)(clientUserID, topLevelSyncJSON); err == nil { - seenThreaded = true - t.Logf("seen threaded read receipt") - } else { - lastErr = err - } - if seenThreaded && seenUnthreaded { - t.Logf("seen both read receipts, returning") - return nil - } - return lastErr - }, + syncHasUnthreadedReadReceipt(roomID, alice.UserID, eventB), ) }