mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 11:23:11 -06:00
tweaks
This commit is contained in:
parent
7dcdac3200
commit
691941be89
|
|
@ -33,11 +33,10 @@ import (
|
||||||
const pathPrefixR0 = "/_matrix/client/r0"
|
const pathPrefixR0 = "/_matrix/client/r0"
|
||||||
|
|
||||||
func Setup(apiMux *mux.Router, accountDB *accounts.Database, deviceDB *devices.Database) {
|
func Setup(apiMux *mux.Router, accountDB *accounts.Database, deviceDB *devices.Database) {
|
||||||
|
|
||||||
r0mux := apiMux.PathPrefix(pathPrefixR0).Subrouter()
|
r0mux := apiMux.PathPrefix(pathPrefixR0).Subrouter()
|
||||||
|
|
||||||
authData := auth.Data{
|
authData := auth.Data{
|
||||||
AccountDB: nil,
|
AccountDB: accountDB,
|
||||||
DeviceDB: deviceDB,
|
DeviceDB: deviceDB,
|
||||||
AppServices: nil,
|
AppServices: nil,
|
||||||
}
|
}
|
||||||
|
|
@ -45,6 +44,6 @@ func Setup(apiMux *mux.Router, accountDB *accounts.Database, deviceDB *devices.D
|
||||||
r0mux.Handle("/user_directory/search",
|
r0mux.Handle("/user_directory/search",
|
||||||
common.MakeAuthAPI("user_directory_search", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
|
common.MakeAuthAPI("user_directory_search", authData, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
|
||||||
return search.Search(req, accountDB)
|
return search.Search(req, accountDB)
|
||||||
})).Methods(http.MethodPost)
|
}),
|
||||||
|
).Methods(http.MethodPost)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ type userSearchRequest struct {
|
||||||
SearchTerm string `json:"search_term"`
|
SearchTerm string `json:"search_term"`
|
||||||
Limit int8 `json:"limit"`
|
Limit int8 `json:"limit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type userSearchResponse struct {
|
type userSearchResponse struct {
|
||||||
Results *[]searchtypes.SearchResult `json:"results"`
|
Results *[]searchtypes.SearchResult `json:"results"`
|
||||||
Limited bool `json:"limited"`
|
Limited bool `json:"limited"`
|
||||||
|
|
@ -76,5 +77,4 @@ func mapProfilesToResponse(results *[]searchtypes.SearchResult, limited bool) ut
|
||||||
Code: http.StatusOK,
|
Code: http.StatusOK,
|
||||||
JSON: userSearchResponse{results, limited},
|
JSON: userSearchResponse{results, limited},
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue