aboutsummaryrefslogtreecommitdiff
path: root/clientapi/routing/routing.go
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-07-28 10:53:17 +0100
committerGitHub <noreply@github.com>2020-07-28 10:53:17 +0100
commitacc8e80a51515c953c6710cb24f36fd9d1f7aeb1 (patch)
treeb33ecfd8e4d7ed3ac7aa66226f8fd80c1cdcf649 /clientapi/routing/routing.go
parentc63286713570e1274759db971b15405665fa391a (diff)
User directory (#1225)
* User directory * Fix syncapi unit test * Make user directory only show remote users you know about from your joined rooms * Update sytest-whitelist * Review comments
Diffstat (limited to 'clientapi/routing/routing.go')
-rw-r--r--clientapi/routing/routing.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/clientapi/routing/routing.go b/clientapi/routing/routing.go
index 5724a20c..ebb141ef 100644
--- a/clientapi/routing/routing.go
+++ b/clientapi/routing/routing.go
@@ -574,6 +574,27 @@ func Setup(
}),
).Methods(http.MethodGet)
+ r0mux.Handle("/user_directory/search",
+ httputil.MakeAuthAPI("userdirectory_search", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse {
+ postContent := struct {
+ SearchString string `json:"search_term"`
+ Limit int `json:"limit"`
+ }{}
+ if err := json.NewDecoder(req.Body).Decode(&postContent); err != nil {
+ return util.ErrorResponse(err)
+ }
+ return *SearchUserDirectory(
+ req.Context(),
+ device,
+ userAPI,
+ stateAPI,
+ cfg.Matrix.ServerName,
+ postContent.SearchString,
+ postContent.Limit,
+ )
+ }),
+ ).Methods(http.MethodPost, http.MethodOptions)
+
r0mux.Handle("/rooms/{roomID}/members",
httputil.MakeAuthAPI("rooms_members", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse {
vars, err := httputil.URLDecodeMapValues(mux.Vars(req))