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