Remove MemberShipStateAll
This commit is contained in:
parent
699617ee4d
commit
7c6a162c0f
|
@ -296,14 +296,8 @@ func (s *membershipStatements) SelectRoomsWithMembership(
|
||||||
rows *sql.Rows
|
rows *sql.Rows
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
stmt := sqlutil.TxStmt(txn, s.selectRoomsWithMembershipStmt)
|
||||||
if membershipState == tables.MemberShipStateAll {
|
rows, err = stmt.QueryContext(ctx, membershipState, userID)
|
||||||
stmt := sqlutil.TxStmt(txn, s.selectRoomsForUserStmt)
|
|
||||||
rows, err = stmt.QueryContext(ctx, userID)
|
|
||||||
} else {
|
|
||||||
stmt := sqlutil.TxStmt(txn, s.selectRoomsWithMembershipStmt)
|
|
||||||
rows, err = stmt.QueryContext(ctx, membershipState, userID)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -1046,8 +1046,6 @@ func (d *Database) GetRoomsByMembership(ctx context.Context, userID, membership
|
||||||
membershipState = tables.MembershipStateLeaveOrBan
|
membershipState = tables.MembershipStateLeaveOrBan
|
||||||
case "ban":
|
case "ban":
|
||||||
membershipState = tables.MembershipStateLeaveOrBan
|
membershipState = tables.MembershipStateLeaveOrBan
|
||||||
case "all":
|
|
||||||
membershipState = tables.MemberShipStateAll
|
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("GetRoomsByMembership: invalid membership %s", membership)
|
return nil, fmt.Errorf("GetRoomsByMembership: invalid membership %s", membership)
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,13 +274,8 @@ func (s *membershipStatements) SelectRoomsWithMembership(
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
if membershipState == tables.MemberShipStateAll {
|
stmt := sqlutil.TxStmt(txn, s.selectRoomsWithMembershipStmt)
|
||||||
stmt := sqlutil.TxStmt(txn, s.selectRoomsForUserStmt)
|
rows, err = stmt.QueryContext(ctx, membershipState, userID)
|
||||||
rows, err = stmt.QueryContext(ctx, userID)
|
|
||||||
} else {
|
|
||||||
stmt := sqlutil.TxStmt(txn, s.selectRoomsWithMembershipStmt)
|
|
||||||
rows, err = stmt.QueryContext(ctx, membershipState, userID)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -113,7 +113,6 @@ type Invites interface {
|
||||||
type MembershipState int64
|
type MembershipState int64
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MemberShipStateAll MembershipState = 0
|
|
||||||
MembershipStateLeaveOrBan MembershipState = 1
|
MembershipStateLeaveOrBan MembershipState = 1
|
||||||
MembershipStateInvite MembershipState = 2
|
MembershipStateInvite MembershipState = 2
|
||||||
MembershipStateJoin MembershipState = 3
|
MembershipStateJoin MembershipState = 3
|
||||||
|
|
Loading…
Reference in a new issue