diff --git a/syncapi/internal/history_visibility.go b/syncapi/internal/history_visibility.go index fbf50b3be..1cfd7ec21 100644 --- a/syncapi/internal/history_visibility.go +++ b/syncapi/internal/history_visibility.go @@ -120,7 +120,7 @@ func GetStateForEvents(ctx context.Context, db storage.Database, events []gomatr } // get the membership event var membership string - membership, memberPos, err := db.SelectMembershipForUser(ctx, ev.RoomID, userID, int(pos.Depth)) + membership, memberPos, err := db.SelectMembershipForUser(ctx, ev.RoomID, userID, int64(pos.Depth)) if err != nil { return nil, err } diff --git a/syncapi/storage/interface.go b/syncapi/storage/interface.go index 343d635bf..3f4053a53 100644 --- a/syncapi/storage/interface.go +++ b/syncapi/storage/interface.go @@ -163,7 +163,7 @@ type Database interface { // SelectMembershipForUser returns the membership of the user before and including the given position. If no membership can be found // returns "leave", the topological position and no error. If an error occurs, other than sql.ErrNoRows, returns that and an empty // string as the membership. - SelectMembershipForUser(ctx context.Context, roomID, userID string, pos int) (membership string, topologicalPos int, err error) + SelectMembershipForUser(ctx context.Context, roomID, userID string, pos int64) (membership string, topologicalPos int, err error) } type Presence interface { diff --git a/syncapi/storage/postgres/memberships_table.go b/syncapi/storage/postgres/memberships_table.go index 0b959bab2..939d6b3f5 100644 --- a/syncapi/storage/postgres/memberships_table.go +++ b/syncapi/storage/postgres/memberships_table.go @@ -142,7 +142,7 @@ func (s *membershipsStatements) SelectHeroes( // returns "leave", the topological position and no error. If an error occurs, other than sql.ErrNoRows, returns that and an empty // string as the membership. func (s *membershipsStatements) SelectMembershipForUser( - ctx context.Context, txn *sql.Tx, roomID, userID string, pos int, + ctx context.Context, txn *sql.Tx, roomID, userID string, pos int64, ) (membership string, topologyPos int, err error) { stmt := sqlutil.TxStmt(txn, s.selectMembershipForUserStmt) err = stmt.QueryRowContext(ctx, roomID, userID, pos).Scan(&membership, &topologyPos) diff --git a/syncapi/storage/shared/syncserver.go b/syncapi/storage/shared/syncserver.go index 34eaca565..9e48ea271 100644 --- a/syncapi/storage/shared/syncserver.go +++ b/syncapi/storage/shared/syncserver.go @@ -1072,6 +1072,6 @@ func (d *Database) SelectTopologicalEvent(ctx context.Context, topologicalPositi return d.OutputEvents.SelectTopologicalEvent(ctx, nil, topologicalPosition, eventType, roomID) } -func (d *Database) SelectMembershipForUser(ctx context.Context, roomID, userID string, pos int) (membership string, topologicalPos int, err error) { +func (d *Database) SelectMembershipForUser(ctx context.Context, roomID, userID string, pos int64) (membership string, topologicalPos int, err error) { return d.Memberships.SelectMembershipForUser(ctx, nil, roomID, userID, pos) } diff --git a/syncapi/storage/sqlite3/memberships_table.go b/syncapi/storage/sqlite3/memberships_table.go index f5c887302..0c966fca0 100644 --- a/syncapi/storage/sqlite3/memberships_table.go +++ b/syncapi/storage/sqlite3/memberships_table.go @@ -158,7 +158,7 @@ func (s *membershipsStatements) SelectHeroes( // returns "leave", the topological position and no error. If an error occurs, other than sql.ErrNoRows, returns that and an empty // string as the membership. func (s *membershipsStatements) SelectMembershipForUser( - ctx context.Context, txn *sql.Tx, roomID, userID string, pos int, + ctx context.Context, txn *sql.Tx, roomID, userID string, pos int64, ) (membership string, topologyPos int, err error) { stmt := sqlutil.TxStmt(txn, s.selectMembershipForUserStmt) err = stmt.QueryRowContext(ctx, roomID, userID, pos).Scan(&membership, &topologyPos) diff --git a/syncapi/storage/tables/interface.go b/syncapi/storage/tables/interface.go index e6ec797fe..eb5e4b355 100644 --- a/syncapi/storage/tables/interface.go +++ b/syncapi/storage/tables/interface.go @@ -174,7 +174,7 @@ type Memberships interface { UpsertMembership(ctx context.Context, txn *sql.Tx, event *gomatrixserverlib.HeaderedEvent, streamPos, topologicalPos types.StreamPosition) error SelectMembershipCount(ctx context.Context, txn *sql.Tx, roomID, membership string, pos types.StreamPosition) (count int, err error) SelectHeroes(ctx context.Context, txn *sql.Tx, roomID, userID string, memberships []string) (heroes []string, err error) - SelectMembershipForUser(ctx context.Context, txn *sql.Tx, roomID, userID string, pos int) (membership string, topologicalPos int, err error) + SelectMembershipForUser(ctx context.Context, txn *sql.Tx, roomID, userID string, pos int64) (membership string, topologicalPos int, err error) } type NotificationData interface {