@@ -51,6 +51,21 @@ func syncHasThreadedReadReceipt(roomID, userID, eventID, threadID string) client
5151 })
5252}
5353
54+ // Disables push rules that are introduced in MSC4306 (if present),
55+ // because they interfere with the normal semantics of notifications in threads.
56+ func disableMsc4306PushRules (t * testing.T , user * client.CSAPI ) {
57+ rules := []string {".io.element.msc4306.rule.subscribed_thread" , ".io.element.msc4306.rule.unsubscribed_thread" }
58+ for _ , rule := range rules {
59+ res := user .GetPushRule (t , "global" , "postcontent" , rule )
60+ if res .StatusCode == 404 {
61+ // No push rule to disable
62+ continue
63+ }
64+
65+ user .MustDisablePushRule (t , "global" , "postcontent" , rule )
66+ }
67+ }
68+
5469// Test behavior of threaded receipts and notifications.
5570//
5671// 1. Send a series of messages, some of which are in threads.
@@ -79,7 +94,9 @@ func TestThreadedReceipts(t *testing.T) {
7994
8095 // Create a room with alice and bob.
8196 alice := deployment .Register (t , "hs1" , helpers.RegistrationOpts {})
97+ disableMsc4306PushRules (t , alice )
8298 bob := deployment .Register (t , "hs1" , helpers.RegistrationOpts {})
99+ disableMsc4306PushRules (t , bob )
83100
84101 roomID := alice .MustCreateRoom (t , map [string ]interface {}{"preset" : "public_chat" })
85102 bob .MustJoinRoom (t , roomID , nil )
@@ -312,7 +329,9 @@ func TestThreadReceiptsInSyncMSC4102(t *testing.T) {
312329
313330 // Create a room with alice and bob.
314331 alice := deployment .Register (t , "hs1" , helpers.RegistrationOpts {})
332+ disableMsc4306PushRules (t , alice )
315333 bob := deployment .Register (t , "hs2" , helpers.RegistrationOpts {})
334+ disableMsc4306PushRules (t , bob )
316335 roomID := alice .MustCreateRoom (t , map [string ]interface {}{"preset" : "public_chat" })
317336 bob .MustJoinRoom (t , roomID , []spec.ServerName {
318337 deployment .GetFullyQualifiedHomeserverName (t , "hs1" ),
0 commit comments