mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Update to make change easier to read
This commit is contained in:
parent
5ce7f13bba
commit
d7626b94d9
|
|
@ -301,18 +301,10 @@ func (d *Database) GetAccountByLocalpart(ctx context.Context, localpart string,
|
||||||
) (*api.Account, error) {
|
) (*api.Account, error) {
|
||||||
// try to get the account with lowercase localpart (majority)
|
// try to get the account with lowercase localpart (majority)
|
||||||
acc, err := d.Accounts.SelectAccountByLocalpart(ctx, strings.ToLower(localpart))
|
acc, err := d.Accounts.SelectAccountByLocalpart(ctx, strings.ToLower(localpart))
|
||||||
switch err {
|
if err == sql.ErrNoRows {
|
||||||
case sql.ErrNoRows: // try with localpart as passed by the request
|
acc, err = d.Accounts.SelectAccountByLocalpart(ctx, localpart) // 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
|
|
||||||
}
|
}
|
||||||
|
return acc, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// SearchProfiles returns all profiles where the provided localpart or display name
|
// SearchProfiles returns all profiles where the provided localpart or display name
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue