summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-12-12 20:45:32 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-12-12 20:45:32 +0000
commite29539df9c2b8f31b46ac20a7fb8337a5b4bc4de (patch)
treeeddc65abcb5c1d70262d3194f20ba3b3673c2ccc
parent7e9c454478797cfaa4f5590188980ca045c9d5e5 (diff)
downloadredmine-e29539df9c2b8f31b46ac20a7fb8337a5b4bc4de.tar.gz
redmine-e29539df9c2b8f31b46ac20a7fb8337a5b4bc4de.zip
Fixed: 'assigned to me' filter broken.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@979 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/query.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 4133abd88..ded8be770 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -54,7 +54,6 @@ class Query < ActiveRecord::Base
serialize :column_names
attr_protected :project, :user
- attr_accessor :executed_by
validates_presence_of :name, :on => :save
validates_length_of :name, :maximum => 255
@@ -112,8 +111,7 @@ class Query < ActiveRecord::Base
def initialize(attributes = nil)
super attributes
self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} }
- @executed_by = User.current.logged? ? User.current : nil
- set_language_if_valid(executed_by.language) if executed_by
+ set_language_if_valid(User.current.language)
end
def validate
@@ -145,12 +143,12 @@ class Query < ActiveRecord::Base
"done_ratio" => { :type => :integer, :order => 13 }}
user_values = []
- user_values << ["<< #{l(:label_me)} >>", "me"] if executed_by
+ user_values << ["<< #{l(:label_me)} >>", "me"] if User.current.logged?
if project
user_values += project.users.sort.collect{|s| [s.name, s.id.to_s] }
- elsif executed_by
+ else
# members of the user's projects
- user_values += executed_by.projects.collect(&:users).flatten.uniq.sort.collect{|s| [s.name, s.id.to_s] }
+ user_values += User.current.projects.collect(&:users).flatten.uniq.sort.collect{|s| [s.name, s.id.to_s] }
end
@available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => user_values } unless user_values.empty?
@available_filters["author_id"] = { :type => :list, :order => 5, :values => user_values } unless user_values.empty?
@@ -267,7 +265,7 @@ class Query < ActiveRecord::Base
elsif project
clause << "#{Issue.table_name}.project_id=%d" % project.id
else
- clause << Project.visible_by(executed_by)
+ clause << Project.visible_by(User.current)
end
# filters clauses
@@ -292,7 +290,7 @@ class Query < ActiveRecord::Base
# "me" value subsitution
if %w(assigned_to_id author_id).include?(field)
- v.push(executed_by ? executed_by.id.to_s : "0") if v.delete("me")
+ v.push(User.current.logged? ? User.current.id.to_s : "0") if v.delete("me")
end
case operator_for field