summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2019-06-14 10:59:45 +0100
committerGitHub <noreply@github.com>2019-06-14 10:59:45 +0100
commitad566df746a7643a2f6f2cd9751b1050b992d1bf (patch)
tree37462c4a86c6ff2961493844c6c5ff2618d36bf1 /synapse/handlers
parentMake index unique (diff)
parentMerge branch 'dinsic' into babolivier/userdir_hide_users (diff)
downloadsynapse-ad566df746a7643a2f6f2cd9751b1050b992d1bf.tar.xz
Merge pull request #5420 from matrix-org/babolivier/userdir_hide_users
Add configuration option to hide new users from the user directory
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/register.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py

index a50e82566c..7747964352 100644 --- a/synapse/handlers/register.py +++ b/synapse/handlers/register.py
@@ -74,6 +74,8 @@ class RegistrationHandler(BaseHandler): ) self._server_notices_mxid = hs.config.server_notices_mxid + self._show_in_user_directory = self.hs.config.show_users_in_user_directory + if hs.config.worker_app: self._register_client = ReplicationRegisterServlet.make_client(hs) self._register_device_client = ( @@ -298,6 +300,14 @@ class RegistrationHandler(BaseHandler): user_id, threepid_dict, None, False, ) + # Prevent the new user from showing up in the user directory if the server + # mandates it. + if not self._show_in_user_directory: + yield self.store.add_account_data_for_user( + user_id, "im.vector.hide_profile", {'hide_profile': True}, + ) + yield self.profile_handler.set_active(user, False, True) + defer.returnValue((user_id, token)) @defer.inlineCallbacks