mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-22 14:21:55 -06:00
Fix linter errors
This commit is contained in:
parent
59753aba98
commit
2acc285f38
|
@ -43,6 +43,7 @@ type sendPDUsRequest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendPDUs implements /sendPDUs
|
// SendPDUs implements /sendPDUs
|
||||||
|
// nolint:gocyclo
|
||||||
func SendPDUs(
|
func SendPDUs(
|
||||||
req *http.Request, device *api.Device,
|
req *http.Request, device *api.Device,
|
||||||
cfg *config.ClientAPI,
|
cfg *config.ClientAPI,
|
||||||
|
@ -195,17 +196,17 @@ func SendPDUs(
|
||||||
JSON: spec.Forbidden("invalid state_key for membership event"),
|
JSON: spec.Forbidden("invalid state_key for membership event"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userID, err := rsAPI.QueryUserIDForSender(req.Context(), pdu.RoomID(), spec.SenderID(*stateKey))
|
invitedUserID, err := rsAPI.QueryUserIDForSender(req.Context(), pdu.RoomID(), spec.SenderID(*stateKey))
|
||||||
if err != nil || userID == nil {
|
if err != nil || invitedUserID == nil {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusNotFound,
|
Code: http.StatusNotFound,
|
||||||
JSON: spec.NotFound("cannot find userID for invite event"),
|
JSON: spec.NotFound("cannot find userID for invite event"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !cfg.Matrix.IsLocalServerName(spec.ServerName(userID.Domain())) {
|
if !cfg.Matrix.IsLocalServerName(spec.ServerName(invitedUserID.Domain())) {
|
||||||
inviteReq := roomserverAPI.PerformInviteRequestCryptoIDs{
|
inviteReq := roomserverAPI.PerformInviteRequestCryptoIDs{
|
||||||
RoomID: pdu.RoomID().String(),
|
RoomID: pdu.RoomID().String(),
|
||||||
UserID: *userID,
|
UserID: *invitedUserID,
|
||||||
InviteEvent: pdu,
|
InviteEvent: pdu,
|
||||||
}
|
}
|
||||||
err := rsAPI.PerformSendInviteCryptoIDs(req.Context(), &inviteReq)
|
err := rsAPI.PerformSendInviteCryptoIDs(req.Context(), &inviteReq)
|
||||||
|
|
|
@ -535,8 +535,8 @@ func generateSendEvent(
|
||||||
|
|
||||||
var identity fclient.SigningIdentity
|
var identity fclient.SigningIdentity
|
||||||
if !cryptoIDs {
|
if !cryptoIDs {
|
||||||
id, err := rsAPI.SigningIdentityFor(ctx, *validRoomID, *fullUserID)
|
id, idErr := rsAPI.SigningIdentityFor(ctx, *validRoomID, *fullUserID)
|
||||||
if err != nil {
|
if idErr != nil {
|
||||||
return nil, &util.JSONResponse{
|
return nil, &util.JSONResponse{
|
||||||
Code: http.StatusInternalServerError,
|
Code: http.StatusInternalServerError,
|
||||||
JSON: spec.InternalServerError{},
|
JSON: spec.InternalServerError{},
|
||||||
|
|
|
@ -198,6 +198,7 @@ func OnIncomingStateRequest(ctx context.Context, device *userapi.Device, rsAPI a
|
||||||
// state to see if there is an event with that type and state key, if there
|
// state to see if there is an event with that type and state key, if there
|
||||||
// is then (by default) we return the content, otherwise a 404.
|
// is then (by default) we return the content, otherwise a 404.
|
||||||
// If eventFormat=true, sends the whole event else just the content.
|
// If eventFormat=true, sends the whole event else just the content.
|
||||||
|
// nolint:gocyclo
|
||||||
func OnIncomingStateTypeRequest(
|
func OnIncomingStateTypeRequest(
|
||||||
ctx context.Context, device *userapi.Device, rsAPI api.ClientRoomserverAPI,
|
ctx context.Context, device *userapi.Device, rsAPI api.ClientRoomserverAPI,
|
||||||
roomID, evType, stateKey string, eventFormat bool,
|
roomID, evType, stateKey string, eventFormat bool,
|
||||||
|
|
|
@ -310,7 +310,7 @@ func (r *FederationInternalAPI) PerformMakeJoin(
|
||||||
WrappedError: nil,
|
WrappedError: nil,
|
||||||
Message: "Unknown HTTP error",
|
Message: "Unknown HTTP error",
|
||||||
}
|
}
|
||||||
if lastError != nil {
|
if lastErr != nil {
|
||||||
lastError.Message = lastErr.Error()
|
lastError.Message = lastErr.Error()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -451,7 +451,7 @@ func (r *FederationInternalAPI) PerformSendJoin(
|
||||||
WrappedError: nil,
|
WrappedError: nil,
|
||||||
Message: "Unknown HTTP error",
|
Message: "Unknown HTTP error",
|
||||||
}
|
}
|
||||||
if lastError != nil {
|
if lastErr != nil {
|
||||||
lastError.Message = lastErr.Error()
|
lastError.Message = lastErr.Error()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,6 @@ func (r *FederationInternalAPI) PerformSendJoin(
|
||||||
"failed to join user %q to room %q through %d server(s): last error %s",
|
"failed to join user %q to room %q through %d server(s): last error %s",
|
||||||
request.UserID, request.RoomID, len(request.ServerNames), lastError,
|
request.UserID, request.RoomID, len(request.ServerNames), lastError,
|
||||||
)
|
)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *FederationInternalAPI) performSendJoinUsingServer(
|
func (r *FederationInternalAPI) performSendJoinUsingServer(
|
||||||
|
|
|
@ -663,8 +663,8 @@ func (r *Joiner) performJoinRoomByIDCryptoIDs(
|
||||||
|
|
||||||
// If we should do a forced federated join then do that.
|
// If we should do a forced federated join then do that.
|
||||||
if forceFederatedJoin {
|
if forceFederatedJoin {
|
||||||
joinEvent, version, serverName, err := r.performFederatedMakeJoinByIDCryptoIDs(ctx, req)
|
joinEvent, version, serverName, federatedJoinErr := r.performFederatedMakeJoinByIDCryptoIDs(ctx, req)
|
||||||
return joinEvent, req.RoomIDOrAlias, version, serverName, err
|
return joinEvent, req.RoomIDOrAlias, version, serverName, federatedJoinErr
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to construct an actual join event from the template.
|
// Try to construct an actual join event from the template.
|
||||||
|
@ -746,8 +746,8 @@ func (r *Joiner) performJoinRoomByIDCryptoIDs(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform a federated room join.
|
// Perform a federated room join.
|
||||||
joinEvent, version, serverName, err := r.performFederatedMakeJoinByIDCryptoIDs(ctx, req)
|
joinEvent, version, serverName, federatedJoinErr := r.performFederatedMakeJoinByIDCryptoIDs(ctx, req)
|
||||||
return joinEvent, req.RoomIDOrAlias, version, serverName, err
|
return joinEvent, req.RoomIDOrAlias, version, serverName, federatedJoinErr
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Something else went wrong.
|
// Something else went wrong.
|
||||||
|
|
Loading…
Reference in a new issue