mirror of
https://github.com/discourse/discourse.git
synced 2025-07-02 05:35:40 +08:00
Fix group matching SQL query
The check there is intended for the :members_mods_and_admins level, which is not automatically checked for normal users. Instead, the :everyone level is the one used, which would always fulfill the "alias_level in :levels" check. This changes the :everyone level to :members_mods_and_admins, which was originally intended.
This commit is contained in:
@ -125,7 +125,7 @@ class Group < ActiveRecord::Base
|
||||
|
||||
Group.where("name LIKE :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)
|
||||
|
Reference in New Issue
Block a user