From 1e73175e27972ac0c49360267770cec64905310e Mon Sep 17 00:00:00 2001 From: Till Faelligen <2353100+S7evinK@users.noreply.github.com> Date: Tue, 30 May 2023 18:01:19 +0200 Subject: [PATCH] Remove LatestState --- go.mod | 2 +- go.sum | 2 ++ roomserver/api/api.go | 1 - roomserver/internal/query/query.go | 24 ------------------------ 4 files changed, 3 insertions(+), 26 deletions(-) diff --git a/go.mod b/go.mod index 55851fbe6..521c98d70 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91 github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 - github.com/matrix-org/gomatrixserverlib v0.0.0-20230525131408-9e1377a918b6 + github.com/matrix-org/gomatrixserverlib v0.0.0-20230530160030-2640a7efaaaa github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 github.com/mattn/go-sqlite3 v1.14.16 diff --git a/go.sum b/go.sum index 05e4b7d7c..1d7518fad 100644 --- a/go.sum +++ b/go.sum @@ -325,6 +325,8 @@ github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 h1:kHKxCOLcHH8 github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s= github.com/matrix-org/gomatrixserverlib v0.0.0-20230525131408-9e1377a918b6 h1:GZJdDQt/IJynQyWpHsYYWQUyCu9Y+asAdwfL7pJNQHU= github.com/matrix-org/gomatrixserverlib v0.0.0-20230525131408-9e1377a918b6/go.mod h1:H9V9N3Uqn1bBJqYJNGK1noqtgJTaCEhtTdcH/mp50uU= +github.com/matrix-org/gomatrixserverlib v0.0.0-20230530160030-2640a7efaaaa h1:m0wWaq2qvMJdYrj5p/mLXV11gbFEKNd6o7C16poSlW0= +github.com/matrix-org/gomatrixserverlib v0.0.0-20230530160030-2640a7efaaaa/go.mod h1:H9V9N3Uqn1bBJqYJNGK1noqtgJTaCEhtTdcH/mp50uU= github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a h1:awrPDf9LEFySxTLKYBMCiObelNx/cBuv/wzllvCCH3A= github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a/go.mod h1:HchJX9oKMXaT2xYFs0Ha/6Zs06mxLU8k6F1ODnrGkeQ= github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 h1:6z4KxomXSIGWqhHcfzExgkH3Z3UkIXry4ibJS4Aqz2Y= diff --git a/roomserver/api/api.go b/roomserver/api/api.go index 0627770f5..213e16e5d 100644 --- a/roomserver/api/api.go +++ b/roomserver/api/api.go @@ -197,7 +197,6 @@ type UserRoomserverAPI interface { } type FederationRoomserverAPI interface { - gomatrixserverlib.LatestStateQuerier InputRoomEventsAPI QueryLatestEventsAndStateAPI QueryBulkStateContentAPI diff --git a/roomserver/internal/query/query.go b/roomserver/internal/query/query.go index c81692ce1..effcc90d7 100644 --- a/roomserver/internal/query/query.go +++ b/roomserver/internal/query/query.go @@ -55,30 +55,6 @@ func (r *Queryer) QueryLatestEventsAndState( return helpers.QueryLatestEventsAndState(ctx, r.DB, request, response) } -func (r *Queryer) LatestState( - ctx context.Context, roomID spec.RoomID, userID spec.UserID, -) ([]gomatrixserverlib.PDU, error) { - request := &api.QueryLatestEventsAndStateRequest{ - RoomID: roomID.String(), - StateToFetch: []gomatrixserverlib.StateKeyTuple{ - { - EventType: spec.MRoomMember, - StateKey: userID.String(), - }, - }, - } - response := &api.QueryLatestEventsAndStateResponse{} - err := helpers.QueryLatestEventsAndState(ctx, r.DB, request, response) - if err != nil { - return nil, err - } - res := make([]gomatrixserverlib.PDU, 0, len(response.StateEvents)) - for _, ev := range response.StateEvents { - res = append(res, ev.PDU) - } - return res, nil -} - // QueryStateAfterEvents implements api.RoomserverInternalAPI func (r *Queryer) QueryStateAfterEvents( ctx context.Context,