From e874853ed00d9400a36f54f765bc570777ddff3a Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 12 Nov 2021 09:38:14 +0000 Subject: [PATCH] Clean up a bit --- federationsender/internal/perform.go | 7 ------- roomserver/internal/input/input.go | 3 ++- roomserver/internal/perform/perform_join.go | 5 ++--- roomserver/version/version.go | 2 +- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/federationsender/internal/perform.go b/federationsender/internal/perform.go index 82ba85dd..623e7cb8 100644 --- a/federationsender/internal/perform.go +++ b/federationsender/internal/perform.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "net/http" "time" "github.com/matrix-org/dendrite/federationsender/api" @@ -116,12 +115,6 @@ func (r *FederationSenderInternalAPI) PerformJoin( // Clear the wrapped error, else serialising to JSON (in polylith mode) will fail httpErr.WrappedError = nil response.LastError = &httpErr - } else if errors.Is(lastErr, &gomatrixserverlib.NotAllowed{}) { - response.LastError = &gomatrix.HTTPError{ - Code: http.StatusForbidden, - WrappedError: lastErr, - Message: lastErr.Error(), - } } else { response.LastError = &gomatrix.HTTPError{ Code: 0, diff --git a/roomserver/internal/input/input.go b/roomserver/internal/input/input.go index a4d43723..de40e133 100644 --- a/roomserver/internal/input/input.go +++ b/roomserver/internal/input/input.go @@ -214,7 +214,8 @@ func (r *Inputer) InputRoomEvents( for _, task := range tasks { if task.err != nil { response.ErrMsg = task.err.Error() - _, response.NotAllowed = task.err.(*gomatrixserverlib.NotAllowed) + _, rejected := task.err.(*gomatrixserverlib.NotAllowed) + response.NotAllowed = rejected return } } diff --git a/roomserver/internal/perform/perform_join.go b/roomserver/internal/perform/perform_join.go index 089df332..b25b273b 100644 --- a/roomserver/internal/perform/perform_join.go +++ b/roomserver/internal/perform/perform_join.go @@ -25,7 +25,6 @@ import ( "github.com/getsentry/sentry-go" fsAPI "github.com/matrix-org/dendrite/federationsender/api" "github.com/matrix-org/dendrite/internal/eventutil" - "github.com/matrix-org/dendrite/roomserver/api" rsAPI "github.com/matrix-org/dendrite/roomserver/api" "github.com/matrix-org/dendrite/roomserver/internal/helpers" "github.com/matrix-org/dendrite/roomserver/internal/input" @@ -61,8 +60,7 @@ func (r *Joiner) PerformJoin( res.Error = perr } else { res.Error = &rsAPI.PerformError{ - Code: api.PerformErrorNotAllowed, // TODO: fix this when cross-boundary handling is better. - Msg: err.Error(), + Msg: err.Error(), } } } @@ -152,6 +150,7 @@ func (r *Joiner) performJoinRoomByAlias( return r.performJoinRoomByID(ctx, req) } +// TODO: Break this function up a bit // nolint:gocyclo func (r *Joiner) performJoinRoomByID( ctx context.Context, diff --git a/roomserver/version/version.go b/roomserver/version/version.go index 1f66995d..729d00a8 100644 --- a/roomserver/version/version.go +++ b/roomserver/version/version.go @@ -23,7 +23,7 @@ import ( // DefaultRoomVersion contains the room version that will, by // default, be used to create new rooms on this server. func DefaultRoomVersion() gomatrixserverlib.RoomVersion { - return gomatrixserverlib.RoomVersionV6 + return gomatrixserverlib.RoomVersionV9 } // RoomVersions returns a map of all known room versions to this