mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-01 09:39:51 -04: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:
parent
92cb52e76e
commit
24e30aff87
1 changed files with 1 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue