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)

This commit is contained in:
reivilibre 2023-02-28 17:11:26 +00:00 committed by GitHub
parent 682d31c702
commit d62cd940cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 77 additions and 2 deletions

View file

@ -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)