0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-15 02:43:54 +01:00

fix async/await consentresource (#5585)

Fixes #5582
This commit is contained in:
Amber Brown 2019-07-01 23:33:52 +10:00 committed by GitHub
parent 04196a4dae
commit b4914681a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

1
changelog.d/5585.misc Normal file
View file

@ -0,0 +1 @@
Synapse can now handle RestServlets that return coroutines.

View file

@ -23,6 +23,8 @@ from six.moves import http_client
import jinja2 import jinja2
from jinja2 import TemplateNotFound from jinja2 import TemplateNotFound
from twisted.internet import defer
from synapse.api.errors import NotFoundError, StoreError, SynapseError from synapse.api.errors import NotFoundError, StoreError, SynapseError
from synapse.config import ConfigError from synapse.config import ConfigError
from synapse.http.server import ( from synapse.http.server import (
@ -139,7 +141,7 @@ class ConsentResource(DirectServeResource):
else: else:
qualified_user_id = UserID(username, self.hs.hostname).to_string() qualified_user_id = UserID(username, self.hs.hostname).to_string()
u = await self.store.get_user_by_id(qualified_user_id) u = await defer.maybeDeferred(self.store.get_user_by_id, qualified_user_id)
if u is None: if u is None:
raise NotFoundError("Unknown user") raise NotFoundError("Unknown user")