mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-21 22:03:10 -06:00
Fix client API return type for send invite error
This commit is contained in:
parent
db57d7e00b
commit
0db85d21dc
|
|
@ -223,7 +223,10 @@ func SendInvite(
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.GetLogger(req.Context()).WithError(err).Error("roomserverAPI.SendInvite failed")
|
util.GetLogger(req.Context()).WithError(err).Error("roomserverAPI.SendInvite failed")
|
||||||
return jsonerror.InternalServerError()
|
return util.JSONResponse{
|
||||||
|
Code: http.StatusForbidden,
|
||||||
|
JSON: jsonerror.Forbidden(err.Error()),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusOK,
|
Code: http.StatusOK,
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ func SendInvite(
|
||||||
Kind: KindNew,
|
Kind: KindNew,
|
||||||
Event: inviteEvent,
|
Event: inviteEvent,
|
||||||
AuthEventIDs: inviteEvent.AuthEventIDs(),
|
AuthEventIDs: inviteEvent.AuthEventIDs(),
|
||||||
SendAsServer: DoNotSendToOtherServers,
|
SendAsServer: string(sendAsServer),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
federationSenderAPI "github.com/matrix-org/dendrite/federationsender/api"
|
federationSenderAPI "github.com/matrix-org/dendrite/federationsender/api"
|
||||||
|
|
@ -95,10 +96,7 @@ func (r *RoomserverInternalAPI) PerformInvite(
|
||||||
// For now we will implement option 2. Since in the abesence of a retry
|
// For now we will implement option 2. Since in the abesence of a retry
|
||||||
// mechanism it will be equivalent to option 1, and we don't have a
|
// mechanism it will be equivalent to option 1, and we don't have a
|
||||||
// signalling mechanism to implement option 3.
|
// signalling mechanism to implement option 3.
|
||||||
return &api.PerformError{
|
return errors.New("The user is already in the room")
|
||||||
Code: api.PerformErrorNoOperation,
|
|
||||||
Msg: "user is already joined to room",
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if isOriginLocal {
|
if isOriginLocal {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue