diff --git a/models/user/search.go b/models/user/search.go index 24a21777e8..453d09558d 100644 --- a/models/user/search.go +++ b/models/user/search.go @@ -39,13 +39,21 @@ type SearchUserOptions struct { } func (opts *SearchUserOptions) toSearchQueryBase() *xorm.Session { - var cond builder.Cond = builder.Eq{"type": opts.Type} + var cond builder.Cond + if opts.Type == UserTypeIdentity { + cond = builder.Or( + builder.Eq{"type": UserTypeIndividual}, + builder.Eq{"type": UserTypeOrganization}, + ) + } else { + cond = builder.Eq{"type": opts.Type} + } if len(opts.Keyword) > 0 { lowerKeyword := strings.ToLower(opts.Keyword) keywordCond := builder.Or( builder.Like{"lower_name", lowerKeyword}, builder.Like{"LOWER(full_name)", lowerKeyword}, - builder.Like{"LOWER(description)", lowerKeyword}, + builder.Like{"LOWER(description)", lowerKeyword}, ) if opts.SearchByEmail { keywordCond = keywordCond.Or(builder.Like{"LOWER(email)", lowerKeyword}) diff --git a/models/user/user.go b/models/user/user.go index 5ce5d3cbd5..9270951449 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -46,6 +46,9 @@ const ( // UserTypeOrganization defines an organization UserTypeOrganization + + // UserTypeIdentity defines individual + organization + UserTypeIdentity ) const ( diff --git a/routers/web/explore/competence.go b/routers/web/explore/competence.go index 0fb9d90067..ccd7bf64f2 100644 --- a/routers/web/explore/competence.go +++ b/routers/web/explore/competence.go @@ -23,7 +23,7 @@ func Competences(ctx *context.Context) { RenderUserSearch(ctx, &user_model.SearchUserOptions{ Actor: ctx.User, - Type: user_model.UserTypeIndividual, + Type: user_model.UserTypeIdentity, ListOptions: db.ListOptions{PageSize: setting.UI.ExplorePagingNum}, IsActive: util.OptionalBoolTrue, Visible: []structs.VisibleType{structs.VisibleTypePublic, structs.VisibleTypeLimited, structs.VisibleTypePrivate},