diff --git a/app/models/query.rb b/app/models/query.rb index 5c5a7a063c..418f894315 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -191,13 +191,14 @@ class Query < ActiveRecord::Base role_values = Role.givable.collect {|r| [r.name, r.id.to_s] } @available_filters["assigned_to_role"] = { :type => :list_optional, :order => 7, :values => role_values, :name => I18n.t('query_fields.assigned_to_role') } unless role_values.empty? - + @available_filters["responsible_id"] = { :type => :list_optional, :order => 4, :values => assigned_to_values } unless assigned_to_values.empty? if User.current.logged? # populate the watcher list with the same user list as other user filters if the user has the :view_work_package_watchers permission in at least one project # TODO: this could be differentiated more, e.g. all users could watch issues in public projects, but won't necessarily be shown here - watcher_values = User.current.allowed_to_globally?(:view_work_package_watchers, {}) ? user_values : [["<< #{l(:label_me)} >>", "me"]] - @available_filters["watcher_id"] = { :type => :list, :order => 15, :values => watcher_values, :user_filter => true } + watcher_values = [["<< #{l(:label_me)} >>", "me"]] + user_values.each { |v| watcher_values << v } if User.current.allowed_to_globally?(:view_work_packages_watchers, {}) + @available_filters["watcher_id"] = { :type => :list, :order => 15, :values => watcher_values } end if project @@ -430,7 +431,14 @@ class Query < ActiveRecord::Base # "me" value subsitution if @@user_filters.include? field - v.push(User.current.logged? ? User.current.id.to_s : "0") if v.delete("me") + if v.delete("me") + if User.current.logged? + v.push(User.current.id.to_s) + v += User.current.group_ids.map(&:to_s) if field == 'assigned_to_id' + else + v.push("0") + end + end end sql = ''