mirror of
https://github.com/go-gitea/gitea.git
synced 2024-05-11 05:55:29 +00:00
Add support for search by uid (#4876)
Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
@ -1337,6 +1337,7 @@ func GetUser(user *User) (bool, error) {
|
||||
type SearchUserOptions struct {
|
||||
Keyword string
|
||||
Type UserType
|
||||
UID int64
|
||||
OrderBy SearchOrderBy
|
||||
Page int
|
||||
PageSize int // Can be smaller than or equal to setting.UI.ExplorePagingNum
|
||||
@ -1355,9 +1356,14 @@ func (opts *SearchUserOptions) toConds() builder.Cond {
|
||||
if opts.SearchByEmail {
|
||||
keywordCond = keywordCond.Or(builder.Like{"LOWER(email)", lowerKeyword})
|
||||
}
|
||||
|
||||
cond = cond.And(keywordCond)
|
||||
}
|
||||
|
||||
if opts.UID > 0 {
|
||||
cond = cond.And(builder.Eq{"id": opts.UID})
|
||||
}
|
||||
|
||||
if !opts.IsActive.IsNone() {
|
||||
cond = cond.And(builder.Eq{"is_active": opts.IsActive.IsTrue()})
|
||||
}
|
||||
|
Reference in New Issue
Block a user