mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Add endpoint to get threepids from server
This commit is contained in:
parent
4eea5cf6c2
commit
117f35ac4a
@ -88,6 +88,18 @@ class ThreepidRestServlet(RestServlet):
|
|||||||
self.identity_handler = hs.get_handlers().identity_handler
|
self.identity_handler = hs.get_handlers().identity_handler
|
||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def on_GET(self, request):
|
||||||
|
yield run_on_reactor()
|
||||||
|
|
||||||
|
auth_user, _ = yield self.auth.get_user_by_req(request)
|
||||||
|
|
||||||
|
threepids = yield self.hs.get_datastore().user_get_threepids(
|
||||||
|
auth_user.to_string()
|
||||||
|
)
|
||||||
|
|
||||||
|
defer.returnValue((200, {'threepids': threepids}))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def on_POST(self, request):
|
def on_POST(self, request):
|
||||||
yield run_on_reactor()
|
yield run_on_reactor()
|
||||||
|
@ -186,3 +186,14 @@ class RegistrationStore(SQLBaseStore):
|
|||||||
"validated_at": validated_at,
|
"validated_at": validated_at,
|
||||||
"added_at": added_at,
|
"added_at": added_at,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def user_get_threepids(self, user_id):
|
||||||
|
ret = yield self._simple_select_list(
|
||||||
|
"user_threepids", {
|
||||||
|
"user": user_id
|
||||||
|
},
|
||||||
|
['medium', 'address', 'validated_at', 'added_at'],
|
||||||
|
'user_get_threepids'
|
||||||
|
)
|
||||||
|
defer.returnValue(ret)
|
Loading…
Reference in New Issue
Block a user