Fix stupid mistake.. and just return the NullString
This commit is contained in:
parent
88612ddd0c
commit
60ba4b5612
|
@ -142,9 +142,9 @@ func (s *accountsStatements) InsertAccount(
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
if accountType != api.AccountTypeAppService {
|
if accountType != api.AccountTypeAppService {
|
||||||
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, nil, accountType)
|
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, nil, accountType, policyVersion)
|
||||||
} else {
|
} else {
|
||||||
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, appserviceID, accountType)
|
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, appserviceID, accountType, policyVersion)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -219,10 +219,10 @@ func (s *accountsStatements) SelectNewNumericLocalpart(
|
||||||
func (s *accountsStatements) SelectPrivacyPolicy(
|
func (s *accountsStatements) SelectPrivacyPolicy(
|
||||||
ctx context.Context, txn *sql.Tx, localPart string,
|
ctx context.Context, txn *sql.Tx, localPart string,
|
||||||
) (policy string, err error) {
|
) (policy string, err error) {
|
||||||
|
var policyNull sql.NullString
|
||||||
stmt := sqlutil.TxStmt(txn, s.selectPrivacyPolicyStmt)
|
stmt := sqlutil.TxStmt(txn, s.selectPrivacyPolicyStmt)
|
||||||
|
err = stmt.QueryRowContext(ctx, localPart).Scan(&policyNull)
|
||||||
err = stmt.QueryRowContext(ctx, localPart).Scan(&policy)
|
return policyNull.String, err
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// batchSelectPrivacyPolicy queries all users which didn't accept the current policy version
|
// batchSelectPrivacyPolicy queries all users which didn't accept the current policy version
|
||||||
|
|
|
@ -144,9 +144,9 @@ func (s *accountsStatements) InsertAccount(
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
if accountType != api.AccountTypeAppService {
|
if accountType != api.AccountTypeAppService {
|
||||||
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, nil, accountType)
|
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, nil, accountType, policyVersion)
|
||||||
} else {
|
} else {
|
||||||
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, appserviceID, accountType)
|
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, appserviceID, accountType, policyVersion)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -225,9 +225,10 @@ func (s *accountsStatements) SelectNewNumericLocalpart(
|
||||||
func (s *accountsStatements) SelectPrivacyPolicy(
|
func (s *accountsStatements) SelectPrivacyPolicy(
|
||||||
ctx context.Context, txn *sql.Tx, localPart string,
|
ctx context.Context, txn *sql.Tx, localPart string,
|
||||||
) (policy string, err error) {
|
) (policy string, err error) {
|
||||||
|
var policyNull sql.NullString
|
||||||
stmt := sqlutil.TxStmt(txn, s.selectPrivacyPolicyStmt)
|
stmt := sqlutil.TxStmt(txn, s.selectPrivacyPolicyStmt)
|
||||||
err = stmt.QueryRowContext(ctx, localPart).Scan(&policy)
|
err = stmt.QueryRowContext(ctx, localPart).Scan(&policyNull)
|
||||||
return
|
return policyNull.String, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// batchSelectPrivacyPolicy queries all users which didn't accept the current policy version
|
// batchSelectPrivacyPolicy queries all users which didn't accept the current policy version
|
||||||
|
|
Loading…
Reference in a new issue