Add missing AccountType to return value

This commit is contained in:
Till Faelligen 2022-02-10 18:09:23 +01:00
parent 587fda0b6f
commit b5c8fc922c
3 changed files with 4 additions and 6 deletions

View file

@ -78,6 +78,7 @@ func (a *UserInternalAPI) PerformAccountCreation(ctx context.Context, req *api.P
Localpart: req.Localpart,
ServerName: a.ServerName,
UserID: fmt.Sprintf("@%s:%s", req.Localpart, a.ServerName),
AccountType: req.AccountType,
}
return nil
}

View file

@ -119,6 +119,7 @@ func (s *accountsStatements) insertAccount(
UserID: userutil.MakeUserID(localpart, s.serverName),
ServerName: s.serverName,
AppServiceID: appserviceID,
AccountType: accountType,
}, nil
}
@ -148,10 +149,9 @@ func (s *accountsStatements) selectAccountByLocalpart(
) (*api.Account, error) {
var appserviceIDPtr sql.NullString
var acc api.Account
var accType api.AccountType
stmt := s.selectAccountByLocalpartStmt
err := stmt.QueryRowContext(ctx, localpart).Scan(&acc.Localpart, &appserviceIDPtr, &accType)
err := stmt.QueryRowContext(ctx, localpart).Scan(&acc.Localpart, &appserviceIDPtr, &acc.AccountType)
if err != nil {
if err != sql.ErrNoRows {
log.WithError(err).Error("Unable to retrieve user from the db")
@ -164,7 +164,6 @@ func (s *accountsStatements) selectAccountByLocalpart(
acc.UserID = userutil.MakeUserID(localpart, s.serverName)
acc.ServerName = s.serverName
acc.AccountType = accType
return &acc, nil
}

View file

@ -148,10 +148,9 @@ func (s *accountsStatements) selectAccountByLocalpart(
) (*api.Account, error) {
var appserviceIDPtr sql.NullString
var acc api.Account
var accType api.AccountType
stmt := s.selectAccountByLocalpartStmt
err := stmt.QueryRowContext(ctx, localpart).Scan(&acc.Localpart, &appserviceIDPtr, &accType)
err := stmt.QueryRowContext(ctx, localpart).Scan(&acc.Localpart, &appserviceIDPtr, &acc.AccountType)
if err != nil {
if err != sql.ErrNoRows {
log.WithError(err).Error("Unable to retrieve user from the db")
@ -164,7 +163,6 @@ func (s *accountsStatements) selectAccountByLocalpart(
acc.UserID = userutil.MakeUserID(localpart, s.serverName)
acc.ServerName = s.serverName
acc.AccountType = accType
return &acc, nil
}