@ -434,9 +434,15 @@ class Query < ActiveRecord::Base
sql_parts<<"#{WorkPackage.table_name}.id #{operator=='='?'IN':'NOT IN'} (SELECT #{db_table}.watchable_id FROM #{db_table} WHERE #{db_table}.watchable_type='WorkPackage' AND #{sql_for_fieldfield,'=',[user_id],db_table,db_field})"
end
# filter watchers only in projects the user has the permission to view watchers in
sql_parts<<"#{WorkPackage.table_name}.id #{operator=='='?'IN':'NOT IN'} (SELECT #{db_table}.watchable_id FROM #{db_table} WHERE #{db_table}.watchable_type='WorkPackage' AND #{sql_for_fieldfield,'=',values,db_table,db_field})"\
" AND #{Project.table_name}.id IN (#{project_ids.join(',')})"unlessproject_ids.empty?