From 5c74ab406445e2dca677b65d8545aeed2a79c4ae Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 4 May 2018 00:53:56 +0100 Subject: [PATCH] fix user_id / user confusion --- synapse/handlers/register.py | 10 +++++----- synapse/types.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py index 9a1af53df..14031cea4 100644 --- a/synapse/handlers/register.py +++ b/synapse/handlers/register.py @@ -178,7 +178,7 @@ class RegistrationHandler(BaseHandler): if display_name: yield self.profile_handler.set_displayname( - user_id, user_id, display_name, by_admin=True, + user, user, display_name, by_admin=True, ) if self.hs.config.user_directory_search_all_users: @@ -208,7 +208,7 @@ class RegistrationHandler(BaseHandler): ) yield self.profile_handler.set_displayname( - user_id, user_id, user.localpart, by_admin=True, + user, user, user.localpart, by_admin=True, ) except SynapseError: @@ -257,7 +257,7 @@ class RegistrationHandler(BaseHandler): ) yield self.profile_handler.set_displayname( - user_id, user_id, user.localpart, by_admin=True, + user, user, user.localpart, by_admin=True, ) defer.returnValue(user_id) @@ -308,7 +308,7 @@ class RegistrationHandler(BaseHandler): ) yield self.profile_handler.set_displayname( - user_id, user_id, user.localpart, by_admin=True, + user, user, user.localpart, by_admin=True, ) except Exception as e: yield self.store.add_access_token_to_user(user_id, token) @@ -466,7 +466,7 @@ class RegistrationHandler(BaseHandler): ) if displayname is not None: yield self.profile_handler.set_displayname( - user_id, user_id, displayname, by_admin=True, + user, user, displayname, by_admin=True, ) else: yield self._auth_handler.delete_access_tokens_for_user(user_id) diff --git a/synapse/types.py b/synapse/types.py index 46be4a071..00e6e1c36 100644 --- a/synapse/types.py +++ b/synapse/types.py @@ -238,7 +238,7 @@ def strip_invalid_mxid_characters(localpart): Returns: localpart (basestring): the localpart having been stripped """ - return filter(lambda c: c not in mxid_localpart_allowed_characters, localpart) + return filter(lambda c: c in mxid_localpart_allowed_characters, localpart) class StreamToken(