0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-18 22:54:39 +01:00
synapse/tests/handlers
David Robertson f7b034a24b
Consistently exclude from user_directory (#10960)
* Introduce `should_include_local_users_in_dir`

We exclude three kinds of local users from the user_directory tables. At
present we don't consistently exclude all three in the same places. This
commit introduces a new function to gather those exclusion conditions
together. Because we have to handle local and remote users in different
ways, I've made that function only consider the case of remote users.
It's the caller's responsibility to make the local versus remote
distinction clear and correct.

A test fixup is required. The test now hits a path which makes db
queries against the users table. The expected rows were missing, because
we were using a dummy user that hadn't actually been registered.

We also add new test cases to covert the exclusion logic.

----

By my reading this makes these changes:

* When an app service user registers or changes their profile, they will
  _not_ be added to the user directory. (Previously only support and
  deactivated users were excluded). This is consistent with the logic that
  rebuilds the user directory. See also [the discussion
  here](https://github.com/matrix-org/synapse/pull/10914#discussion_r716859548).
* When rebuilding the directory, exclude support and disabled users from
  room sharing tables. Previously only appservice users were excluded.
* Exclude all three categories of local users when rebuilding the
  directory. Previously `_populate_user_directory_process_users` didn't do
  any exclusion.

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2021-10-04 11:45:51 +00:00
..
__init__.py
oidc_test_key.p8
oidc_test_key.pub.pem
test_admin.py Flatten the synapse.rest.client package (#10600) 2021-08-17 11:57:58 +00:00
test_appservice.py
test_auth.py Use direct references for configuration variables (part 4). (#10893) 2021-09-23 12:03:01 -04:00
test_cas.py
test_device.py
test_directory.py Use direct references for configuration variables (part 5). (#10897) 2021-09-24 07:25:21 -04:00
test_e2e_keys.py
test_e2e_room_keys.py
test_federation.py Factor out common code for persisting fetched auth events (#10896) 2021-09-24 11:56:33 +01:00
test_message.py Flatten the synapse.rest.client package (#10600) 2021-08-17 11:57:58 +00:00
test_oidc.py
test_password_providers.py Flatten the synapse.rest.client package (#10600) 2021-08-17 11:57:58 +00:00
test_presence.py Split FederationHandler in half (#10692) 2021-08-26 21:41:44 +01:00
test_profile.py Use direct references for configuration variables (part 7). (#10959) 2021-10-04 07:18:54 -04:00
test_receipts.py Add type hints for event streams. (#10856) 2021-09-21 13:34:26 -04:00
test_register.py Clean-up registration tests (#10945) 2021-09-30 14:06:02 -04:00
test_room.py Pull out encrypted_by_default tests from user_directory tests (#10752) 2021-09-06 11:37:54 +01:00
test_room_summary.py Ignore rooms with unknown room versions in the spaces summary. (#10727) 2021-09-01 17:01:08 +00:00
test_saml.py
test_send_email.py Fix incompatibility with Twisted < 21. (#10713) 2021-08-27 16:33:41 +01:00
test_stats.py Use direct references for configuration variables (part 5). (#10897) 2021-09-24 07:25:21 -04:00
test_sync.py Do not include rooms with an unknown room version in a sync response. (#10644) 2021-08-19 11:12:55 -04:00
test_typing.py Add type hints for event streams. (#10856) 2021-09-21 13:34:26 -04:00
test_user_directory.py Consistently exclude from user_directory (#10960) 2021-10-04 11:45:51 +00:00