Fix stupid mistake.. and just return the NullString

This commit is contained in:
Till Faelligen 2022-05-04 17:53:49 +02:00
parent 88612ddd0c
commit 60ba4b5612
2 changed files with 10 additions and 9 deletions

View file

@ -142,9 +142,9 @@ func (s *accountsStatements) InsertAccount(
var err error
if accountType != api.AccountTypeAppService {
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, nil, accountType)
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, nil, accountType, policyVersion)
} else {
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, appserviceID, accountType)
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, appserviceID, accountType, policyVersion)
}
if err != nil {
return nil, err
@ -219,10 +219,10 @@ func (s *accountsStatements) SelectNewNumericLocalpart(
func (s *accountsStatements) SelectPrivacyPolicy(
ctx context.Context, txn *sql.Tx, localPart string,
) (policy string, err error) {
var policyNull sql.NullString
stmt := sqlutil.TxStmt(txn, s.selectPrivacyPolicyStmt)
err = stmt.QueryRowContext(ctx, localPart).Scan(&policy)
return
err = stmt.QueryRowContext(ctx, localPart).Scan(&policyNull)
return policyNull.String, err
}
// batchSelectPrivacyPolicy queries all users which didn't accept the current policy version

View file

@ -144,9 +144,9 @@ func (s *accountsStatements) InsertAccount(
var err error
if accountType != api.AccountTypeAppService {
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, nil, accountType)
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, nil, accountType, policyVersion)
} else {
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, appserviceID, accountType)
_, err = stmt.ExecContext(ctx, localpart, createdTimeMS, hash, appserviceID, accountType, policyVersion)
}
if err != nil {
return nil, err
@ -225,9 +225,10 @@ func (s *accountsStatements) SelectNewNumericLocalpart(
func (s *accountsStatements) SelectPrivacyPolicy(
ctx context.Context, txn *sql.Tx, localPart string,
) (policy string, err error) {
var policyNull sql.NullString
stmt := sqlutil.TxStmt(txn, s.selectPrivacyPolicyStmt)
err = stmt.QueryRowContext(ctx, localPart).Scan(&policy)
return
err = stmt.QueryRowContext(ctx, localPart).Scan(&policyNull)
return policyNull.String, err
}
// batchSelectPrivacyPolicy queries all users which didn't accept the current policy version