mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 05:07:53 +08:00
Merge pull request #1824 from riking/patch-2
Fix group matching SQL query
This commit is contained in:
commit
447816fe39
|
@ -123,9 +123,9 @@ class Group < ActiveRecord::Base
|
|||
ALIAS_LEVELS[:members_mods_and_admins]]
|
||||
end
|
||||
|
||||
Group.where("name LIKE :term_like AND (" +
|
||||
Group.where("name ILIKE :term_like AND (" +
|
||||
" alias_level in (:levels)" +
|
||||
" OR (alias_level = #{ALIAS_LEVELS[:everyone]} AND id in (" +
|
||||
" OR (alias_level = #{ALIAS_LEVELS[:members_mods_and_admins]} AND id in (" +
|
||||
"SELECT group_id FROM group_users WHERE user_id= :user_id)" +
|
||||
")" +
|
||||
")", term_like: "#{name.downcase}%", levels: levels, user_id: current_user.id)
|
||||
|
|
Loading…
Reference in New Issue
Block a user