mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FIX: Better match when searching for groups.
This commit is contained in:
parent
ab2a5cef38
commit
edf4af608e
3 changed files with 25 additions and 23 deletions
|
@ -369,10 +369,14 @@ class Group < ActiveRecord::Base
|
|||
lookup_group(name) || refresh_automatic_group!(name)
|
||||
end
|
||||
|
||||
def self.search_group(name)
|
||||
Group.where(visibility_level: visibility_levels[:public]).where(
|
||||
"name ILIKE :term_like OR full_name ILIKE :term_like", term_like: "#{name}%"
|
||||
)
|
||||
def self.search_groups(name, groups: nil)
|
||||
query = groups || Group
|
||||
|
||||
query
|
||||
.where(visibility_level: visibility_levels[:public])
|
||||
.where(
|
||||
"name ILIKE :term_like OR full_name ILIKE :term_like", term_like: "%#{name}%"
|
||||
)
|
||||
end
|
||||
|
||||
def self.lookup_group(name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue