mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Clean up a bit
This commit is contained in:
parent
6016d378a0
commit
e874853ed0
4 changed files with 5 additions and 12 deletions
|
@ -5,7 +5,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/federationsender/api"
|
"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
|
// Clear the wrapped error, else serialising to JSON (in polylith mode) will fail
|
||||||
httpErr.WrappedError = nil
|
httpErr.WrappedError = nil
|
||||||
response.LastError = &httpErr
|
response.LastError = &httpErr
|
||||||
} else if errors.Is(lastErr, &gomatrixserverlib.NotAllowed{}) {
|
|
||||||
response.LastError = &gomatrix.HTTPError{
|
|
||||||
Code: http.StatusForbidden,
|
|
||||||
WrappedError: lastErr,
|
|
||||||
Message: lastErr.Error(),
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
response.LastError = &gomatrix.HTTPError{
|
response.LastError = &gomatrix.HTTPError{
|
||||||
Code: 0,
|
Code: 0,
|
||||||
|
|
|
@ -214,7 +214,8 @@ func (r *Inputer) InputRoomEvents(
|
||||||
for _, task := range tasks {
|
for _, task := range tasks {
|
||||||
if task.err != nil {
|
if task.err != nil {
|
||||||
response.ErrMsg = task.err.Error()
|
response.ErrMsg = task.err.Error()
|
||||||
_, response.NotAllowed = task.err.(*gomatrixserverlib.NotAllowed)
|
_, rejected := task.err.(*gomatrixserverlib.NotAllowed)
|
||||||
|
response.NotAllowed = rejected
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ import (
|
||||||
"github.com/getsentry/sentry-go"
|
"github.com/getsentry/sentry-go"
|
||||||
fsAPI "github.com/matrix-org/dendrite/federationsender/api"
|
fsAPI "github.com/matrix-org/dendrite/federationsender/api"
|
||||||
"github.com/matrix-org/dendrite/internal/eventutil"
|
"github.com/matrix-org/dendrite/internal/eventutil"
|
||||||
"github.com/matrix-org/dendrite/roomserver/api"
|
|
||||||
rsAPI "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/helpers"
|
||||||
"github.com/matrix-org/dendrite/roomserver/internal/input"
|
"github.com/matrix-org/dendrite/roomserver/internal/input"
|
||||||
|
@ -61,7 +60,6 @@ func (r *Joiner) PerformJoin(
|
||||||
res.Error = perr
|
res.Error = perr
|
||||||
} else {
|
} else {
|
||||||
res.Error = &rsAPI.PerformError{
|
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)
|
return r.performJoinRoomByID(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Break this function up a bit
|
||||||
// nolint:gocyclo
|
// nolint:gocyclo
|
||||||
func (r *Joiner) performJoinRoomByID(
|
func (r *Joiner) performJoinRoomByID(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
// DefaultRoomVersion contains the room version that will, by
|
// DefaultRoomVersion contains the room version that will, by
|
||||||
// default, be used to create new rooms on this server.
|
// default, be used to create new rooms on this server.
|
||||||
func DefaultRoomVersion() gomatrixserverlib.RoomVersion {
|
func DefaultRoomVersion() gomatrixserverlib.RoomVersion {
|
||||||
return gomatrixserverlib.RoomVersionV6
|
return gomatrixserverlib.RoomVersionV9
|
||||||
}
|
}
|
||||||
|
|
||||||
// RoomVersions returns a map of all known room versions to this
|
// RoomVersions returns a map of all known room versions to this
|
||||||
|
|
Loading…
Reference in a new issue