Membership viewing API when user left the room (#194)

* Implement case where user left the room

* Filter by membership event

* Move the logic from the storage to the query API

* Fix check on state entries iteration

* Remove aliases methods from query API

* Use structure for response to match with the spec

* Remove filtering on /members and implement /joined_members
This commit is contained in:
Brendan Abolivier 2017-08-24 16:00:14 +01:00 committed by Mark Haines
parent fceb027ecc
commit 685e056ab3
6 changed files with 126 additions and 43 deletions

View file

@ -302,7 +302,14 @@ func Setup(
r0mux.Handle("/rooms/{roomID}/members",
common.MakeAuthAPI("rooms_members", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
vars := mux.Vars(req)
return readers.GetMemberships(req, device, vars["roomID"], accountDB, cfg, queryAPI)
return readers.GetMemberships(req, device, vars["roomID"], false, accountDB, cfg, queryAPI)
}),
)
r0mux.Handle("/rooms/{roomID}/joined_members",
common.MakeAuthAPI("rooms_members", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
vars := mux.Vars(req)
return readers.GetMemberships(req, device, vars["roomID"], true, accountDB, cfg, queryAPI)
}),
)