This commit is contained in:
sw 2015-05-07 11:47:43 +08:00
commit f5e87451b9
1 changed files with 15 additions and 15 deletions

View File

@ -243,15 +243,15 @@ module QueriesHelper
# Retrieve query from session or build a new query # Retrieve query from session or build a new query
def retrieve_query def retrieve_query
if !params[:query_id].blank? # if !params[:query_id].blank?
cond = "project_id IS NULL" # cond = "project_id IS NULL"
cond << " OR project_id = #{@project.id}" if @project # cond << " OR project_id = #{@project.id}" if @project
@query = IssueQuery.find(params[:query_id], :conditions => cond) # @query = IssueQuery.find(params[:query_id], :conditions => cond)
raise ::Unauthorized unless @query.visible? # raise ::Unauthorized unless @query.visible?
@query.project = @project # @query.project = @project
session[:query] = {:id => @query.id, :project_id => @query.project_id} # session[:query] = {:id => @query.id, :project_id => @query.project_id}
sort_clear # sort_clear
elsif api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil) # elsif api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil)
# Give it a name, required to be valid # Give it a name, required to be valid
@query = IssueQuery.new(:name => "_") @query = IssueQuery.new(:name => "_")
@query.project = @project @query.project = @project
@ -268,12 +268,12 @@ module QueriesHelper
'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil? 'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil?
@query.build_from_params(params) @query.build_from_params(params)
#session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names} #session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names}
else # else
# retrieve from session # # retrieve from session
@query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id] # @query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id]
@query ||= IssueQuery.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names]) # @query ||= IssueQuery.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names])
@query.project = @project # @query.project = @project
end # end
end end
def retrieve_query_from_session def retrieve_query_from_session