Merge branch 'master' into develop

This commit is contained in:
Brendan Abolivier 2020-06-16 10:36:29 +01:00
commit 789606577a
7 changed files with 81 additions and 9 deletions

View File

@ -1,3 +1,13 @@
Synapse 1.15.1 (2020-06-16)
===========================
Bugfixes
--------
- Fix a bug introduced in v1.15.0 that would crash Synapse on start when using certain password auth providers. ([\#7684](https://github.com/matrix-org/synapse/issues/7684))
- Fix a bug introduced in v1.15.0 which meant that some 3PID management endpoints were not accessible on the correct URL. ([\#7685](https://github.com/matrix-org/synapse/issues/7685))
Synapse 1.15.0 (2020-06-11) Synapse 1.15.0 (2020-06-11)
=========================== ===========================

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
matrix-synapse-py3 (1.15.1) stable; urgency=medium
* New synapse release 1.15.1.
-- Synapse Packaging team <packages@matrix.org> Tue, 16 Jun 2020 10:27:50 +0100
matrix-synapse-py3 (1.15.0) stable; urgency=medium matrix-synapse-py3 (1.15.0) stable; urgency=medium
* New synapse release 1.15.0. * New synapse release 1.15.0.

View File

@ -36,7 +36,7 @@ try:
except ImportError: except ImportError:
pass pass
__version__ = "1.15.0" __version__ = "1.15.1"
if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)): if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)):
# We import here so that we don't have to install a bunch of deps when # We import here so that we don't have to install a bunch of deps when

View File

@ -126,7 +126,7 @@ class ModuleApi(object):
'errcode' property for more information on the reason for failure 'errcode' property for more information on the reason for failure
Returns: Returns:
Deferred[str]: user_id defer.Deferred[str]: user_id
""" """
return defer.ensureDeferred( return defer.ensureDeferred(
self._hs.get_registration_handler().register_user( self._hs.get_registration_handler().register_user(
@ -149,11 +149,13 @@ class ModuleApi(object):
Returns: Returns:
defer.Deferred[tuple[str, str]]: Tuple of device ID and access token defer.Deferred[tuple[str, str]]: Tuple of device ID and access token
""" """
return self._hs.get_registration_handler().register_device( return defer.ensureDeferred(
self._hs.get_registration_handler().register_device(
user_id=user_id, user_id=user_id,
device_id=device_id, device_id=device_id,
initial_display_name=initial_display_name, initial_display_name=initial_display_name,
) )
)
def record_user_external_id( def record_user_external_id(
self, auth_provider_id: str, remote_user_id: str, registered_user_id: str self, auth_provider_id: str, remote_user_id: str, registered_user_id: str

View File

@ -682,7 +682,7 @@ class ThreepidRestServlet(RestServlet):
class ThreepidAddRestServlet(RestServlet): class ThreepidAddRestServlet(RestServlet):
PATTERNS = client_patterns("/account/3pid/add$", releases=(), unstable=True) PATTERNS = client_patterns("/account/3pid/add$")
def __init__(self, hs): def __init__(self, hs):
super(ThreepidAddRestServlet, self).__init__() super(ThreepidAddRestServlet, self).__init__()
@ -733,7 +733,7 @@ class ThreepidAddRestServlet(RestServlet):
class ThreepidBindRestServlet(RestServlet): class ThreepidBindRestServlet(RestServlet):
PATTERNS = client_patterns("/account/3pid/bind$", releases=(), unstable=True) PATTERNS = client_patterns("/account/3pid/bind$")
def __init__(self, hs): def __init__(self, hs):
super(ThreepidBindRestServlet, self).__init__() super(ThreepidBindRestServlet, self).__init__()
@ -762,7 +762,7 @@ class ThreepidBindRestServlet(RestServlet):
class ThreepidUnbindRestServlet(RestServlet): class ThreepidUnbindRestServlet(RestServlet):
PATTERNS = client_patterns("/account/3pid/unbind$", releases=(), unstable=True) PATTERNS = client_patterns("/account/3pid/unbind$")
def __init__(self, hs): def __init__(self, hs):
super(ThreepidUnbindRestServlet, self).__init__() super(ThreepidUnbindRestServlet, self).__init__()

View File

View File

@ -0,0 +1,54 @@
# -*- coding: utf-8 -*-
# Copyright 2020 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from synapse.module_api import ModuleApi
from tests.unittest import HomeserverTestCase
class ModuleApiTestCase(HomeserverTestCase):
def prepare(self, reactor, clock, homeserver):
self.store = homeserver.get_datastore()
self.module_api = ModuleApi(homeserver, homeserver.get_auth_handler())
def test_can_register_user(self):
"""Tests that an external module can register a user"""
# Register a new user
user_id, access_token = self.get_success(
self.module_api.register(
"bob", displayname="Bobberino", emails=["bob@bobinator.bob"]
)
)
# Check that the new user exists with all provided attributes
self.assertEqual(user_id, "@bob:test")
self.assertTrue(access_token)
self.assertTrue(self.store.get_user_by_id(user_id))
# Check that the email was assigned
emails = self.get_success(self.store.user_get_threepids(user_id))
self.assertEqual(len(emails), 1)
email = emails[0]
self.assertEqual(email["medium"], "email")
self.assertEqual(email["address"], "bob@bobinator.bob")
# Should these be 0?
self.assertEqual(email["validated_at"], 0)
self.assertEqual(email["added_at"], 0)
# Check that the displayname was assigned
displayname = self.get_success(self.store.get_profile_displayname("bob"))
self.assertEqual(displayname, "Bobberino")