diff options
author | reivilibre <oliverw@matrix.org> | 2023-02-28 17:11:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-28 17:11:26 +0000 |
commit | d62cd940cb38e706f7fadc279017b0be3f3f29a3 (patch) | |
tree | e5b11c19e9698052deab9d4ad5d0c093cc58911b /tests/storage | |
parent | Allow use of the `/filter` Client-Server APIs on workers. (#15134) (diff) | |
download | synapse-d62cd940cb38e706f7fadc279017b0be3f3f29a3.tar.xz |
Fix a long-standing bug where an initial sync would not respond to changes to the list of ignored users if there was an initial sync cached. (#15163)
Diffstat (limited to 'tests/storage')
-rw-r--r-- | tests/storage/test_account_data.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/storage/test_account_data.py b/tests/storage/test_account_data.py index 1bfd11ceae..b12691a9d3 100644 --- a/tests/storage/test_account_data.py +++ b/tests/storage/test_account_data.py @@ -140,3 +140,25 @@ class IgnoredUsersTestCase(unittest.HomeserverTestCase): # No one ignores the user now. self.assert_ignored(self.user, set()) self.assert_ignorers("@other:test", set()) + + def test_ignoring_users_with_latest_stream_ids(self) -> None: + """Test that ignoring users updates the latest stream ID for the ignored + user list account data.""" + + def get_latest_ignore_streampos(user_id: str) -> Optional[int]: + return self.get_success( + self.store.get_latest_stream_id_for_global_account_data_by_type_for_user( + user_id, AccountDataTypes.IGNORED_USER_LIST + ) + ) + + self.assertIsNone(get_latest_ignore_streampos("@user:test")) + + self._update_ignore_list("@other:test", "@another:remote") + + self.assertEqual(get_latest_ignore_streampos("@user:test"), 2) + + # Add one user, remove one user, and leave one user. + self._update_ignore_list("@foo:test", "@another:remote") + + self.assertEqual(get_latest_ignore_streampos("@user:test"), 3) |