@@ -1796,4 +1796,35 @@ def test_include(self) -> None:
17961796 thread_roots = [ev ["event_id" ] for ev in channel .json_body ["chunk" ]]
17971797 self .assertEqual (thread_roots , [thread_2 , thread_1 ], channel .json_body )
17981798
1799- # XXX Test ignoring users.
1799+ @unittest .override_config ({"experimental_features" : {"msc3856_enabled" : True }})
1800+ def test_ignored_user (self ) -> None :
1801+ """Events from ignored users should be ignored."""
1802+ # Thread 1 has a reply from an ignored user.
1803+ thread_1 = self .parent_id
1804+ self ._send_relation (
1805+ RelationTypes .THREAD , "m.room.test" , access_token = self .user2_token
1806+ )
1807+
1808+ # Thread 2 is created by an ignored user.
1809+ res = self .helper .send (self .room , body = "Thread Root!" , tok = self .user2_token )
1810+ thread_2 = res ["event_id" ]
1811+ self ._send_relation (RelationTypes .THREAD , "m.room.test" , parent_id = thread_2 )
1812+
1813+ # Ignore user2.
1814+ self .get_success (
1815+ self .store .add_account_data_for_user (
1816+ self .user_id ,
1817+ AccountDataTypes .IGNORED_USER_LIST ,
1818+ {"ignored_users" : {self .user2_id : {}}},
1819+ )
1820+ )
1821+
1822+ # Only thread 1 is returned.
1823+ channel = self .make_request (
1824+ "GET" ,
1825+ f"/_matrix/client/unstable/org.matrix.msc3856/rooms/{ self .room } /threads" ,
1826+ access_token = self .user_token ,
1827+ )
1828+ self .assertEquals (200 , channel .code , channel .json_body )
1829+ thread_roots = [ev ["event_id" ] for ev in channel .json_body ["chunk" ]]
1830+ self .assertEqual (thread_roots , [thread_1 ], channel .json_body )
0 commit comments