From df0a49ff14474dd2230a823f57e95aa9d3b1cd71 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 8 May 2007 12:46:15 +0000 Subject: "me" value is now available in queries for "assigned to" and "author" filters. When executing the query, it is replaced by the currently logged in user. git-svn-id: http://redmine.rubyforge.org/svn/trunk@520 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/feeds_controller.rb | 2 ++ app/controllers/projects_controller.rb | 3 ++- app/controllers/queries_controller.rb | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/feeds_controller.rb b/app/controllers/feeds_controller.rb index 9314db5e3..214f80c95 100644 --- a/app/controllers/feeds_controller.rb +++ b/app/controllers/feeds_controller.rb @@ -37,6 +37,7 @@ class FeedsController < ApplicationController def issues if @project && params[:query_id] query = Query.find(params[:query_id]) + query.executed_by = @user # ignore query if it's not valid query = nil unless query.valid? # override with query conditions @@ -56,6 +57,7 @@ class FeedsController < ApplicationController def history if @project && params[:query_id] query = Query.find(params[:query_id]) + query.executed_by = @user # ignore query if it's not valid query = nil unless query.valid? # override with query conditions diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 82468c21a..e90196495 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -647,11 +647,12 @@ private def retrieve_query if params[:query_id] @query = @project.queries.find(params[:query_id]) + @query.executed_by = logged_in_user session[:query] = @query else if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id # Give it a name, required to be valid - @query = Query.new(:name => "_") + @query = Query.new(:name => "_", :executed_by => logged_in_user) @query.project = @project if params[:fields] and params[:fields].is_a? Array params[:fields].each do |field| diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb index 7f7f01fd3..abafd19d4 100644 --- a/app/controllers/queries_controller.rb +++ b/app/controllers/queries_controller.rb @@ -42,6 +42,7 @@ class QueriesController < ApplicationController private def find_query @query = Query.find(params[:id]) + @query.executed_by = logged_in_user @project = @query.project # check if user is allowed to manage queries (same permission as add_query) authorize('projects', 'add_query') -- cgit v1.2.3