1
0
Fork 0
forked from forgejo/forgejo

Use ID or Where to instead directly use Get when load object from database (#11925)

* Use ID or Where to instead directly use Get when load object from database

* Apply suggestions from code review

Co-authored-by: 6543 <6543@obermui.de>

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
Lunny Xiao 2020-06-18 01:50:11 +08:00 committed by GitHub
parent 61cd0ce866
commit 1645d4a5d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 25 additions and 28 deletions

View file

@ -111,8 +111,8 @@ func GetUserByOpenID(uri string) (*User, error) {
log.Trace("Normalized OpenID URI: " + uri)
// Otherwise, check in openid table
oid := &UserOpenID{URI: uri}
has, err := x.Get(oid)
oid := &UserOpenID{}
has, err := x.Where("uri=?", uri).Get(oid)
if err != nil {
return nil, err
}