Update to make change easier to read

This commit is contained in:
Till Faelligen 2022-03-23 13:26:05 +01:00
parent 5ce7f13bba
commit d7626b94d9

View file

@ -301,18 +301,10 @@ func (d *Database) GetAccountByLocalpart(ctx context.Context, localpart string,
) (*api.Account, error) {
// try to get the account with lowercase localpart (majority)
acc, err := d.Accounts.SelectAccountByLocalpart(ctx, strings.ToLower(localpart))
switch err {
case sql.ErrNoRows: // try with localpart as passed by the request
acc, err = d.Accounts.SelectAccountByLocalpart(ctx, localpart)
if err != nil {
return nil, err
}
return acc, nil
case nil:
return acc, nil
default:
return nil, err
if err == sql.ErrNoRows {
acc, err = d.Accounts.SelectAccountByLocalpart(ctx, localpart) // try with localpart as passed by the request
}
return acc, err
}
// SearchProfiles returns all profiles where the provided localpart or display name