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) {
|
||||
// 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue