Skip to content

Commit

Permalink
Clean up merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhnchris committed Jun 18, 2023
1 parent 02f5d1d commit 6a73bee
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion clientapi/auth/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func LoginFromJSONReader(
if err != nil {
err := &util.JSONResponse{
Code: http.StatusForbidden,
JSON: jsonerror.MissingToken(err.Error()),
JSON: spec.MissingToken(err.Error()),
}
return nil, nil, err
}
Expand Down
1 change: 0 additions & 1 deletion clientapi/routing/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (

"github.com/matrix-org/dendrite/clientapi/auth"
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
"github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/dendrite/clientapi/userutil"
"github.com/matrix-org/dendrite/setup/config"
userapi "github.com/matrix-org/dendrite/userapi/api"
Expand Down
2 changes: 1 addition & 1 deletion clientapi/routing/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestLogin(t *testing.T) {
t.Run("Supported log-in flows are returned", func(t *testing.T) {
req := test.NewRequest(t, http.MethodGet, "/_matrix/client/v3/login")
rec := httptest.NewRecorder()
base.PublicClientAPIMux.ServeHTTP(rec, req)
routers.Client.ServeHTTP(rec, req)
if rec.Code != http.StatusOK {
t.Fatalf("failed to get log-in flows: %s", rec.Body.String())
}
Expand Down
3 changes: 3 additions & 0 deletions clientapi/routing/register_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"net/http"
"net/http/httptest"
"reflect"
"regexp"
"strings"
"testing"
"time"
Expand All @@ -31,6 +32,8 @@ import (
"github.com/matrix-org/dendrite/internal/caching"
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/roomserver"
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/dendrite/setup/jetstream"
"github.com/matrix-org/dendrite/test"
"github.com/matrix-org/dendrite/test/testrig"
"github.com/matrix-org/dendrite/userapi"
Expand Down
12 changes: 6 additions & 6 deletions internal/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"net/http"
"regexp"

"github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/dendrite/clientapi/userutil"
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/matrix-org/util"
)

Expand Down Expand Up @@ -102,7 +102,7 @@ func UsernameResponse(err error) *util.JSONResponse {
}

// ValidateApplicationServiceUsername returns an error if the username is invalid for an application service
func ValidateApplicationServiceUsername(localpart string, domain gomatrixserverlib.ServerName) error {
func ValidateApplicationServiceUsername(localpart string, domain spec.ServerName) error {
userID := userutil.MakeUserID(localpart, domain)
return ValidateApplicationServiceUserID(userID)
}
Expand Down Expand Up @@ -190,7 +190,7 @@ func ValidateApplicationServiceRequest(
if err != nil {
return "", &util.JSONResponse{
Code: http.StatusUnauthorized,
JSON: jsonerror.InvalidUsername(err.Error()),
JSON: spec.InvalidUsername(err.Error()),
}
}

Expand All @@ -208,7 +208,7 @@ func ValidateApplicationServiceRequest(
if matchedApplicationService == nil {
return "", &util.JSONResponse{
Code: http.StatusUnauthorized,
JSON: jsonerror.UnknownToken("Supplied access_token does not match any known application service"),
JSON: spec.UnknownToken("Supplied access_token does not match any known application service"),
}
}

Expand All @@ -217,7 +217,7 @@ func ValidateApplicationServiceRequest(
// If we didn't find any matches, return M_EXCLUSIVE
return "", &util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.ASExclusive(fmt.Sprintf(
JSON: spec.ASExclusive(fmt.Sprintf(
"Supplied username %s did not match any namespaces for application service ID: %s", userIDOrLocalpart, matchedApplicationService.ID)),
}
}
Expand All @@ -226,7 +226,7 @@ func ValidateApplicationServiceRequest(
if userIDMatchesMultipleExclusiveNamespaces(cfg, userID) {
return "", &util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.ASExclusive(fmt.Sprintf(
JSON: spec.ASExclusive(fmt.Sprintf(
"Supplied username %s matches multiple exclusive application service namespaces. Only 1 match allowed", userIDOrLocalpart)),
}
}
Expand Down
3 changes: 1 addition & 2 deletions internal/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import (
"strings"
"testing"

"github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/matrix-org/util"
)

Expand Down

0 comments on commit 6a73bee

Please sign in to comment.