mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 23:13:11 -06:00
stop using maybe
This commit is contained in:
parent
8f2153d3e6
commit
93543abe4b
|
|
@ -181,25 +181,23 @@ func SetLocalAlias(
|
||||||
return *resErr
|
return *resErr
|
||||||
}
|
}
|
||||||
|
|
||||||
maybeRoomID, err := spec.NewRoomID(r.RoomID)
|
roomID, err := spec.NewRoomID(r.RoomID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
JSON: spec.InvalidParam("invalid room ID"),
|
JSON: spec.InvalidParam("invalid room ID"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
roomID := *maybeRoomID // should be safe due to error check
|
|
||||||
|
|
||||||
maybeUserID, err := spec.NewUserID(device.UserID, true)
|
userID, err := spec.NewUserID(device.UserID, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusInternalServerError,
|
Code: http.StatusInternalServerError,
|
||||||
JSON: spec.Unknown("internal server error"),
|
JSON: spec.Unknown("internal server error"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userID := *maybeUserID
|
|
||||||
|
|
||||||
senderID, err := rsAPI.QuerySenderIDForUser(req.Context(), roomID, userID)
|
senderID, err := rsAPI.QuerySenderIDForUser(req.Context(), *roomID, *userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.GetLogger(req.Context()).WithError(err).Error("QuerySenderIDForUser failed")
|
util.GetLogger(req.Context()).WithError(err).Error("QuerySenderIDForUser failed")
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue