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 {
|
||||
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{
|
||||
Code: http.StatusOK,
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ func SendInvite(
|
|||
Kind: KindNew,
|
||||
Event: inviteEvent,
|
||||
AuthEventIDs: inviteEvent.AuthEventIDs(),
|
||||
SendAsServer: DoNotSendToOtherServers,
|
||||
SendAsServer: string(sendAsServer),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package internal
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
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
|
||||
// mechanism it will be equivalent to option 1, and we don't have a
|
||||
// signalling mechanism to implement option 3.
|
||||
return &api.PerformError{
|
||||
Code: api.PerformErrorNoOperation,
|
||||
Msg: "user is already joined to room",
|
||||
}
|
||||
return errors.New("The user is already in the room")
|
||||
}
|
||||
|
||||
if isOriginLocal {
|
||||
|
|
|
|||
Loading…
Reference in a new issue