mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-14 21:32:23 +03:00
msc3861: cr fixes
This commit is contained in:
parent
8df644263c
commit
3eb4c7e1bd
6 changed files with 36 additions and 39 deletions
|
@ -560,26 +560,24 @@ func AdminUserDeviceRetrieveCreate(
|
|||
}
|
||||
|
||||
userDeviceExists := false
|
||||
{
|
||||
var rs api.QueryDevicesResponse
|
||||
if err = userAPI.QueryDevices(req.Context(), &api.QueryDevicesRequest{UserID: userID}, &rs); err != nil {
|
||||
logger.WithError(err).Error("QueryDevices")
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusInternalServerError,
|
||||
JSON: spec.InternalServerError{},
|
||||
}
|
||||
var rs api.QueryDevicesResponse
|
||||
if err = userAPI.QueryDevices(req.Context(), &api.QueryDevicesRequest{UserID: userID}, &rs); err != nil {
|
||||
logger.WithError(err).Error("QueryDevices")
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusInternalServerError,
|
||||
JSON: spec.InternalServerError{},
|
||||
}
|
||||
if !rs.UserExists {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusNotFound,
|
||||
JSON: spec.NotFound("Given user ID does not exist"),
|
||||
}
|
||||
}
|
||||
if !rs.UserExists {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusNotFound,
|
||||
JSON: spec.NotFound("Given user ID does not exist"),
|
||||
}
|
||||
for i := range rs.Devices {
|
||||
if d := rs.Devices[i]; d.ID == payload.DeviceID && d.UserID == userID {
|
||||
userDeviceExists = true
|
||||
break
|
||||
}
|
||||
}
|
||||
for i := range rs.Devices {
|
||||
if d := rs.Devices[i]; d.ID == payload.DeviceID && d.UserID == userID {
|
||||
userDeviceExists = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue