From 691941be89c666890e111181f4fd98929fc6c30d Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 6 Feb 2020 15:04:39 +0000 Subject: [PATCH] tweaks --- userdirectoryapi/routing/routing.go | 7 +++---- userdirectoryapi/search/search.go | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/userdirectoryapi/routing/routing.go b/userdirectoryapi/routing/routing.go index 55e840e9e..6967321a0 100644 --- a/userdirectoryapi/routing/routing.go +++ b/userdirectoryapi/routing/routing.go @@ -33,11 +33,10 @@ import ( const pathPrefixR0 = "/_matrix/client/r0" func Setup(apiMux *mux.Router, accountDB *accounts.Database, deviceDB *devices.Database) { - r0mux := apiMux.PathPrefix(pathPrefixR0).Subrouter() authData := auth.Data{ - AccountDB: nil, + AccountDB: accountDB, DeviceDB: deviceDB, AppServices: nil, } @@ -45,6 +44,6 @@ func Setup(apiMux *mux.Router, accountDB *accounts.Database, deviceDB *devices.D r0mux.Handle("/user_directory/search", common.MakeAuthAPI("user_directory_search", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse { return search.Search(req, accountDB) - })).Methods(http.MethodPost) - + }), + ).Methods(http.MethodPost) } diff --git a/userdirectoryapi/search/search.go b/userdirectoryapi/search/search.go index 5573e97f5..ed0791877 100644 --- a/userdirectoryapi/search/search.go +++ b/userdirectoryapi/search/search.go @@ -35,6 +35,7 @@ type userSearchRequest struct { SearchTerm string `json:"search_term"` Limit int8 `json:"limit"` } + type userSearchResponse struct { Results *[]searchtypes.SearchResult `json:"results"` Limited bool `json:"limited"` @@ -76,5 +77,4 @@ func mapProfilesToResponse(results *[]searchtypes.SearchResult, limited bool) ut Code: http.StatusOK, JSON: userSearchResponse{results, limited}, } - }