diff --git a/app/models/group.rb b/app/models/group.rb index 848b1a4b832..15ce948714e 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -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)