mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
Fix sytest again
This commit is contained in:
parent
abdb1cfbfe
commit
d1781c634e
|
|
@ -103,18 +103,10 @@ func GetPresence(
|
|||
JSON: jsonerror.InternalServerError(),
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("XXX: 1")
|
||||
statusMsg := presence.Header.Get("status_msg")
|
||||
e := presence.Header.Get("error")
|
||||
if e != "" {
|
||||
log.Errorf("received error msg from nats: %s", e)
|
||||
if code := presence.Header.Get("error_code"); code == "404" {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusNotFound,
|
||||
JSON: jsonerror.NotFound("No status for user found."),
|
||||
}
|
||||
}
|
||||
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusOK,
|
||||
JSON: types.PresenceClientResponse{
|
||||
|
|
@ -122,14 +114,17 @@ func GetPresence(
|
|||
},
|
||||
}
|
||||
}
|
||||
log.Debugf("XXX: 2")
|
||||
lastActive, err := strconv.Atoi(presence.Header.Get("last_active_ts"))
|
||||
if err != nil {
|
||||
log.WithError(err).Errorf("WTF?!")
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusInternalServerError,
|
||||
JSON: jsonerror.InternalServerError(),
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("XXX: 3")
|
||||
p := types.PresenceInternal{LastActiveTS: gomatrixserverlib.Timestamp(lastActive)}
|
||||
currentlyActive := p.CurrentlyActive()
|
||||
return util.JSONResponse{
|
||||
|
|
|
|||
|
|
@ -89,15 +89,13 @@ func (s *PresenceConsumer) Start() error {
|
|||
}
|
||||
return
|
||||
}
|
||||
if len(presences) == 0 {
|
||||
m.Header.Set("error", "presence does not exist")
|
||||
m.Header.Set("error_code", "404")
|
||||
if err = msg.RespondMsg(msg); err != nil {
|
||||
logrus.WithError(err).Error("Unable to respond to messages")
|
||||
}
|
||||
return
|
||||
|
||||
presence := &types.PresenceInternal{
|
||||
UserID: userID,
|
||||
}
|
||||
if len(presences) > 0 {
|
||||
presence = presences[0]
|
||||
}
|
||||
presence := presences[0]
|
||||
|
||||
deviceRes := api.QueryDevicesResponse{}
|
||||
if err = s.deviceAPI.QueryDevices(s.ctx, &api.QueryDevicesRequest{UserID: userID}, &deviceRes); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue