diff options
author | Patrick Cloke <patrickc@matrix.org> | 2022-07-26 12:50:15 -0400 |
---|---|---|
committer | Patrick Cloke <patrickc@matrix.org> | 2022-07-27 12:39:43 -0400 |
commit | d510975b2f136ced7ae11b4a1553be3eac5eae7d (patch) | |
tree | 1f491ccd76f7fba5615966ab2b7e391285f39168 | |
parent | Allow limiting threads by participation. (diff) | |
download | synapse-d510975b2f136ced7ae11b4a1553be3eac5eae7d.tar.xz |
Test ignored users.
-rw-r--r-- | tests/rest/client/test_relations.py | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/rest/client/test_relations.py b/tests/rest/client/test_relations.py index 6b302d90bf..9176047ed4 100644 --- a/tests/rest/client/test_relations.py +++ b/tests/rest/client/test_relations.py @@ -1796,4 +1796,35 @@ class ThreadsTestCase(BaseRelationsTestCase): thread_roots = [ev["event_id"] for ev in channel.json_body["chunk"]] self.assertEqual(thread_roots, [thread_2, thread_1], channel.json_body) - # XXX Test ignoring users. + @unittest.override_config({"experimental_features": {"msc3856_enabled": True}}) + def test_ignored_user(self) -> None: + """Events from ignored users should be ignored.""" + # Thread 1 has a reply from an ignored user. + thread_1 = self.parent_id + self._send_relation( + RelationTypes.THREAD, "m.room.test", access_token=self.user2_token + ) + + # Thread 2 is created by an ignored user. + res = self.helper.send(self.room, body="Thread Root!", tok=self.user2_token) + thread_2 = res["event_id"] + self._send_relation(RelationTypes.THREAD, "m.room.test", parent_id=thread_2) + + # Ignore user2. + self.get_success( + self.store.add_account_data_for_user( + self.user_id, + AccountDataTypes.IGNORED_USER_LIST, + {"ignored_users": {self.user2_id: {}}}, + ) + ) + + # Only thread 1 is returned. + channel = self.make_request( + "GET", + f"/_matrix/client/unstable/org.matrix.msc3856/rooms/{self.room}/threads", + access_token=self.user_token, + ) + self.assertEquals(200, channel.code, channel.json_body) + thread_roots = [ev["event_id"] for ev in channel.json_body["chunk"]] + self.assertEqual(thread_roots, [thread_1], channel.json_body) |