Skip to content

Commit

Permalink
models: fix clobbered error (#1764)
Browse files Browse the repository at this point in the history
  • Loading branch information
alrs authored Oct 27, 2023
1 parent b34b667 commit 1643055
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,10 @@ func (u *User) UserGroups(ctx *ctx.Context, limit int, query string) ([]UserGrou
return lst, err
}

var user *User
if len(lst) == 0 && len(query) > 0 {
// 隐藏功能,一般人不告诉,哈哈。query可能是给的用户名,所以上面的sql没有查到,当做user来查一下试试
user, err := UserGetByUsername(ctx, query)
user, err = UserGetByUsername(ctx, query)
if user == nil {
return lst, err
}
Expand Down

0 comments on commit 1643055

Please sign in to comment.