aboutsummaryrefslogtreecommitdiff
path: root/syncapi/routing/memberships.go
diff options
context:
space:
mode:
Diffstat (limited to 'syncapi/routing/memberships.go')
-rw-r--r--syncapi/routing/memberships.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/syncapi/routing/memberships.go b/syncapi/routing/memberships.go
index a23f1525..5a66009c 100644
--- a/syncapi/routing/memberships.go
+++ b/syncapi/routing/memberships.go
@@ -19,13 +19,13 @@ import (
"math"
"net/http"
- "github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/syncapi/storage"
"github.com/matrix-org/dendrite/syncapi/synctypes"
"github.com/matrix-org/dendrite/syncapi/types"
userapi "github.com/matrix-org/dendrite/userapi/api"
"github.com/matrix-org/gomatrixserverlib"
+ "github.com/matrix-org/gomatrixserverlib/spec"
"github.com/matrix-org/util"
)
@@ -67,26 +67,26 @@ func GetMemberships(
var queryRes api.QueryMembershipForUserResponse
if err := rsAPI.QueryMembershipForUser(req.Context(), &queryReq, &queryRes); err != nil {
util.GetLogger(req.Context()).WithError(err).Error("rsAPI.QueryMembershipsForRoom failed")
- return jsonerror.InternalServerError()
+ return spec.InternalServerError()
}
if !queryRes.HasBeenInRoom {
return util.JSONResponse{
Code: http.StatusForbidden,
- JSON: jsonerror.Forbidden("You aren't a member of the room and weren't previously a member of the room."),
+ JSON: spec.Forbidden("You aren't a member of the room and weren't previously a member of the room."),
}
}
if joinedOnly && !queryRes.IsInRoom {
return util.JSONResponse{
Code: http.StatusForbidden,
- JSON: jsonerror.Forbidden("You aren't a member of the room and weren't previously a member of the room."),
+ JSON: spec.Forbidden("You aren't a member of the room and weren't previously a member of the room."),
}
}
db, err := syncDB.NewDatabaseSnapshot(req.Context())
if err != nil {
- return jsonerror.InternalServerError()
+ return spec.InternalServerError()
}
defer db.Rollback() // nolint: errcheck
@@ -98,7 +98,7 @@ func GetMemberships(
atToken, err = db.EventPositionInTopology(req.Context(), queryRes.EventID)
if err != nil {
util.GetLogger(req.Context()).WithError(err).Error("unable to get 'atToken'")
- return jsonerror.InternalServerError()
+ return spec.InternalServerError()
}
}
}
@@ -106,13 +106,13 @@ func GetMemberships(
eventIDs, err := db.SelectMemberships(req.Context(), roomID, atToken, membership, notMembership)
if err != nil {
util.GetLogger(req.Context()).WithError(err).Error("db.SelectMemberships failed")
- return jsonerror.InternalServerError()
+ return spec.InternalServerError()
}
qryRes := &api.QueryEventsByIDResponse{}
if err := rsAPI.QueryEventsByID(req.Context(), &api.QueryEventsByIDRequest{EventIDs: eventIDs, RoomID: roomID}, qryRes); err != nil {
util.GetLogger(req.Context()).WithError(err).Error("rsAPI.QueryEventsByID failed")
- return jsonerror.InternalServerError()
+ return spec.InternalServerError()
}
result := qryRes.Events
@@ -124,7 +124,7 @@ func GetMemberships(
var content databaseJoinedMember
if err := json.Unmarshal(ev.Content(), &content); err != nil {
util.GetLogger(req.Context()).WithError(err).Error("failed to unmarshal event content")
- return jsonerror.InternalServerError()
+ return spec.InternalServerError()
}
res.Joined[ev.Sender()] = joinedMember(content)
}