start hacking it out to get some debug logs

This commit is contained in:
alam0rt 2021-11-04 21:55:03 +11:00
parent 837f50ac89
commit 887bb12b74
3 changed files with 17 additions and 3 deletions

View file

@ -53,7 +53,7 @@ type databaseJoinedMember struct {
// GetMemberships implements GET /rooms/{roomId}/members
func GetMemberships(
req *http.Request, device *userapi.Device, roomID string, joinedOnly bool,
req *http.Request, device *userapi.Device, roomID string, joinedOnly bool, at string,
_ *config.ClientAPI,
rsAPI api.RoomserverInternalAPI,
) util.JSONResponse {
@ -61,6 +61,7 @@ func GetMemberships(
JoinedOnly: joinedOnly,
RoomID: roomID,
Sender: device.UserID,
At: at,
}
var queryRes api.QueryMembershipsForRoomResponse
if err := rsAPI.QueryMembershipsForRoom(req.Context(), &queryReq, &queryRes); err != nil {
@ -91,6 +92,14 @@ func GetMemberships(
JSON: res,
}
}
util.GetLogger(req.Context()).Info("SLOCKART")
for _, ev := range queryRes.JoinEvents {
util.GetLogger(req.Context()).Info(ev)
util.GetLogger(req.Context()).Info(at)
}
util.GetLogger(req.Context()).Error("SLOCKART")
return util.JSONResponse{
Code: http.StatusOK,
JSON: getMembershipResponse{queryRes.JoinEvents},

View file

@ -751,7 +751,10 @@ func Setup(
if err != nil {
return util.ErrorResponse(err)
}
return GetMemberships(req, device, vars["roomID"], false, cfg, rsAPI)
at := req.URL.Query().Get("at")
logrus.Info(req.URL)
return GetMemberships(req, device, vars["roomID"], false, at, cfg, rsAPI)
}),
).Methods(http.MethodGet, http.MethodOptions)
@ -761,7 +764,7 @@ func Setup(
if err != nil {
return util.ErrorResponse(err)
}
return GetMemberships(req, device, vars["roomID"], true, cfg, rsAPI)
return GetMemberships(req, device, vars["roomID"], true, "", cfg, rsAPI)
}),
).Methods(http.MethodGet, http.MethodOptions)

View file

@ -155,6 +155,8 @@ type QueryMembershipsForRoomRequest struct {
// user is allowed to see the memberships. If not specified then all
// room memberships will be returned.
Sender string `json:"sender"`
At string `json:"at"`
}
// QueryMembershipsForRoomResponse is a response to QueryMembershipsForRoom