Browse Source

Во вкладке компетенции выводятся и сообщества тоже #106

pull/118/head
Artur Galyamov 2 years ago
parent
commit
0a6487b3d0
  1. 12
      models/user/search.go
  2. 3
      models/user/user.go
  3. 2
      routers/web/explore/competence.go

12
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})

3
models/user/user.go

@ -46,6 +46,9 @@ const (
// UserTypeOrganization defines an organization
UserTypeOrganization
// UserTypeIdentity defines individual + organization
UserTypeIdentity
)
const (

2
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},

Loading…
Cancel
Save