diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2020-04-23 17:15:03 +0100 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2020-04-23 17:15:03 +0100 |
commit | 6ab8d204790291c5c85d54b219f99a369d4f4661 (patch) | |
tree | 56c76c23fc87d834b6c7758fb03f5521175fa3cd /synapse/rest/client | |
parent | Remove unnecessary shadow server code (diff) | |
download | synapse-6ab8d204790291c5c85d54b219f99a369d4f4661.tar.xz |
Fix missing shadow 3pid function
I think this is where the code removed in 67c6de2caa1ba0f50b11ba0b158e056391cad9c3 was supposed to go.
Diffstat (limited to 'synapse/rest/client')
-rw-r--r-- | synapse/rest/client/v2_alpha/account.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/synapse/rest/client/v2_alpha/account.py b/synapse/rest/client/v2_alpha/account.py index ec120d858c..da6050edda 100644 --- a/synapse/rest/client/v2_alpha/account.py +++ b/synapse/rest/client/v2_alpha/account.py @@ -722,6 +722,7 @@ class ThreepidAddRestServlet(RestServlet): self.identity_handler = hs.get_handlers().identity_handler self.auth = hs.get_auth() self.auth_handler = hs.get_auth_handler() + self.http_client = hs.get_simple_http_client() @interactive_auth_handler async def on_POST(self, request): @@ -764,6 +765,18 @@ class ThreepidAddRestServlet(RestServlet): 400, "No validated 3pid session found", Codes.THREEPID_AUTH_FAILED ) + @defer.inlineCallbacks + def shadow_3pid(self, body, user_id): + # TODO: retries + shadow_hs_url = self.hs.config.shadow_server.get("hs_url") + as_token = self.hs.config.shadow_server.get("as_token") + + yield self.http_client.post_json_get_json( + "%s/_matrix/client/r0/account/3pid?access_token=%s&user_id=%s" + % (shadow_hs_url, as_token, user_id), + body, + ) + class ThreepidBindRestServlet(RestServlet): PATTERNS = client_patterns("/account/3pid/bind$", releases=(), unstable=True) |