Rename Membership to UserJoinedToRoom

This commit is contained in:
Devon Hudson 2023-05-12 10:43:01 -06:00
parent d63f7c3441
commit a77f7e385a
No known key found for this signature in database
GPG key ID: CD06B18E77F6A628
5 changed files with 7 additions and 5 deletions

View file

@ -73,8 +73,8 @@ func (rq *JoinRoomQuerier) ServerInRoom(ctx context.Context, server spec.ServerN
return &joinedResponse, nil
}
func (rq *JoinRoomQuerier) Membership(ctx context.Context, roomNID int64, userID spec.UserID) (bool, error) {
return rq.roomserver.IsInRoom(ctx, types.RoomNID(roomNID), userID)
func (rq *JoinRoomQuerier) UserJoinedToRoom(ctx context.Context, roomNID int64, userID spec.UserID) (bool, error) {
return rq.roomserver.UserJoinedToRoom(ctx, types.RoomNID(roomNID), userID)
}
func (rq *JoinRoomQuerier) GetJoinedUsers(ctx context.Context, roomVersion gomatrixserverlib.RoomVersion, roomNID int64) ([]gomatrixserverlib.PDU, error) {

2
go.mod
View file

@ -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-20230512162258-bdb2e94f6b1f
github.com/matrix-org/gomatrixserverlib v0.0.0-20230512163742-2313af9fcc17
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

2
go.sum
View file

@ -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-20230512162258-bdb2e94f6b1f h1:IUoNmx4LOnLA7iHmD4JFfPlcPqH6DM/oQOL3bmbSaBs=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230512162258-bdb2e94f6b1f/go.mod h1:H9V9N3Uqn1bBJqYJNGK1noqtgJTaCEhtTdcH/mp50uU=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230512163742-2313af9fcc17 h1:2QpV8ZfvPKgT2mks8vWnu1z3bjU2jT7ya0E4j67/xc4=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230512163742-2313af9fcc17/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=

View file

@ -229,7 +229,7 @@ type FederationRoomserverAPI interface {
IsInvitePending(ctx context.Context, roomID spec.RoomID, userID spec.UserID) (bool, error)
QueryRoomInfo(ctx context.Context, roomID spec.RoomID) (*types.RoomInfo, error)
GetStateEvent(ctx context.Context, roomID spec.RoomID, eventType spec.MatrixEventType, stateKey string) (gomatrixserverlib.PDU, error)
IsInRoom(ctx context.Context, roomID types.RoomNID, userID spec.UserID) (bool, error)
UserJoinedToRoom(ctx context.Context, roomID types.RoomNID, userID spec.UserID) (bool, error)
GetLocallyJoinedUsers(ctx context.Context, roomVersion gomatrixserverlib.RoomVersion, roomNID types.RoomNID) ([]gomatrixserverlib.PDU, error)
}

View file

@ -871,7 +871,7 @@ func (r *Queryer) GetStateEvent(ctx context.Context, roomID spec.RoomID, eventTy
return r.DB.GetStateEvent(ctx, roomID.String(), string(eventType), "")
}
func (r *Queryer) IsInRoom(ctx context.Context, roomNID types.RoomNID, userID spec.UserID) (bool, error) {
func (r *Queryer) UserJoinedToRoom(ctx context.Context, roomNID types.RoomNID, userID spec.UserID) (bool, error) {
_, isIn, _, err := r.DB.GetMembership(ctx, roomNID, userID.String())
return isIn, err
}