Remove noise

This commit is contained in:
Till Faelligen 2022-05-04 14:12:52 +02:00
parent dc8cea6d57
commit cd7a7606a1
2 changed files with 2 additions and 21 deletions

View file

@ -115,9 +115,6 @@ const updateMembershipForgetRoom = "" +
const selectRoomsWithMembershipSQL = "" + const selectRoomsWithMembershipSQL = "" +
"SELECT room_nid FROM roomserver_membership WHERE membership_nid = $1 AND target_nid = $2 and forgotten = false" "SELECT room_nid FROM roomserver_membership WHERE membership_nid = $1 AND target_nid = $2 and forgotten = false"
const selectRoomsForUserSQL = "" +
"SELECT room_nid FROM roomserver_membership WHERE target_nid = $1 and forgotten = false"
// selectKnownUsersSQL uses a sub-select statement here to find rooms that the user is // selectKnownUsersSQL uses a sub-select statement here to find rooms that the user is
// joined to. Since this information is used to populate the user directory, we will // joined to. Since this information is used to populate the user directory, we will
// only return users that the user would ordinarily be able to see anyway. // only return users that the user would ordinarily be able to see anyway.
@ -161,7 +158,6 @@ type membershipStatements struct {
updateMembershipForgetRoomStmt *sql.Stmt updateMembershipForgetRoomStmt *sql.Stmt
selectLocalServerInRoomStmt *sql.Stmt selectLocalServerInRoomStmt *sql.Stmt
selectServerInRoomStmt *sql.Stmt selectServerInRoomStmt *sql.Stmt
selectRoomsForUserStmt *sql.Stmt
} }
func createMembershipTable(db *sql.DB) error { func createMembershipTable(db *sql.DB) error {
@ -187,7 +183,6 @@ func prepareMembershipTable(db *sql.DB) (tables.Membership, error) {
{&s.updateMembershipForgetRoomStmt, updateMembershipForgetRoom}, {&s.updateMembershipForgetRoomStmt, updateMembershipForgetRoom},
{&s.selectLocalServerInRoomStmt, selectLocalServerInRoomSQL}, {&s.selectLocalServerInRoomStmt, selectLocalServerInRoomSQL},
{&s.selectServerInRoomStmt, selectServerInRoomSQL}, {&s.selectServerInRoomStmt, selectServerInRoomSQL},
{&s.selectRoomsForUserStmt, selectRoomsForUserSQL},
}.Prepare(db) }.Prepare(db)
} }
@ -296,12 +291,8 @@ func (s *membershipStatements) SelectRoomsWithMembership(
ctx context.Context, txn *sql.Tx, ctx context.Context, txn *sql.Tx,
userID types.EventStateKeyNID, membershipState tables.MembershipState, userID types.EventStateKeyNID, membershipState tables.MembershipState,
) ([]types.RoomNID, error) { ) ([]types.RoomNID, error) {
var (
rows *sql.Rows
err error
)
stmt := sqlutil.TxStmt(txn, s.selectRoomsWithMembershipStmt) stmt := sqlutil.TxStmt(txn, s.selectRoomsWithMembershipStmt)
rows, err = stmt.QueryContext(ctx, membershipState, userID) rows, err := stmt.QueryContext(ctx, membershipState, userID)
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -91,9 +91,6 @@ const updateMembershipForgetRoom = "" +
const selectRoomsWithMembershipSQL = "" + const selectRoomsWithMembershipSQL = "" +
"SELECT room_nid FROM roomserver_membership WHERE membership_nid = $1 AND target_nid = $2 and forgotten = false" "SELECT room_nid FROM roomserver_membership WHERE membership_nid = $1 AND target_nid = $2 and forgotten = false"
const selectRoomsForUserSQL = "" +
"SELECT room_nid FROM roomserver_membership WHERE target_nid = $1 and forgotten = false"
// selectKnownUsersSQL uses a sub-select statement here to find rooms that the user is // selectKnownUsersSQL uses a sub-select statement here to find rooms that the user is
// joined to. Since this information is used to populate the user directory, we will // joined to. Since this information is used to populate the user directory, we will
// only return users that the user would ordinarily be able to see anyway. // only return users that the user would ordinarily be able to see anyway.
@ -137,7 +134,6 @@ type membershipStatements struct {
updateMembershipForgetRoomStmt *sql.Stmt updateMembershipForgetRoomStmt *sql.Stmt
selectLocalServerInRoomStmt *sql.Stmt selectLocalServerInRoomStmt *sql.Stmt
selectServerInRoomStmt *sql.Stmt selectServerInRoomStmt *sql.Stmt
selectRoomsForUserStmt *sql.Stmt
} }
func createMembershipTable(db *sql.DB) error { func createMembershipTable(db *sql.DB) error {
@ -164,7 +160,6 @@ func prepareMembershipTable(db *sql.DB) (tables.Membership, error) {
{&s.updateMembershipForgetRoomStmt, updateMembershipForgetRoom}, {&s.updateMembershipForgetRoomStmt, updateMembershipForgetRoom},
{&s.selectLocalServerInRoomStmt, selectLocalServerInRoomSQL}, {&s.selectLocalServerInRoomStmt, selectLocalServerInRoomSQL},
{&s.selectServerInRoomStmt, selectServerInRoomSQL}, {&s.selectServerInRoomStmt, selectServerInRoomSQL},
{&s.selectRoomsForUserStmt, selectRoomsForUserSQL},
}.Prepare(db) }.Prepare(db)
} }
@ -273,13 +268,8 @@ func (s *membershipStatements) UpdateMembership(
func (s *membershipStatements) SelectRoomsWithMembership( func (s *membershipStatements) SelectRoomsWithMembership(
ctx context.Context, txn *sql.Tx, userID types.EventStateKeyNID, membershipState tables.MembershipState, ctx context.Context, txn *sql.Tx, userID types.EventStateKeyNID, membershipState tables.MembershipState,
) ([]types.RoomNID, error) { ) ([]types.RoomNID, error) {
var (
rows *sql.Rows
err error
)
stmt := sqlutil.TxStmt(txn, s.selectRoomsWithMembershipStmt) stmt := sqlutil.TxStmt(txn, s.selectRoomsWithMembershipStmt)
rows, err = stmt.QueryContext(ctx, membershipState, userID) rows, err := stmt.QueryContext(ctx, membershipState, userID)
if err != nil { if err != nil {
return nil, err return nil, err