Defect #36389

Filter parameters of Query string do not work when default query is enabled

Added by Yuichi HARADA 9 months ago. Updated 7 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Marius BALTEANU% Done:

0%

Category:Filters
Target version:5.0.0
Resolution:Fixed Affected version:

Description

Normally, clicking trackers or numbers in the issues tracking in the project's overview will display the issues list filtered by these conditions.
If the default query is enabled, these filters will be ignored and the default query will be applied to display the issues list.


Related issues

Related to Redmine - Feature #7360: Issue custom query: default query per instance, project a... Closed 2011-01-18
Related to Redmine - Feature #35795: Settings for global and user default custom ProjectQuery Closed

Associated revisions

Revision 21481
Added by Marius BALTEANU 7 months ago

Only check for set_filter param when retriving the default query (#7360, 35795, #36389).

History

#1 Updated by Yuichi HARADA 9 months ago

It seems that you should add without_default referenced by ProjectsController#retrieve_default_query(source:/trunk/app/controllers/projects_controller.rb#L333) and IssuesController#retrieve_default_query(source:/trunk/app/controllers/issues_controller.rb#L489) to the query string.

  def retrieve_default_query(use_session)
    return if params[:query_id].present?
    return if api_request?
    return if params[:set_filter] && (params.key?(:op) || params.key?(:f))

    if params[:without_default].present?
      params[:set_filter] = 1
      return
    end

Maybe you need to fix the following:

% grep -rn "set_filter" * --exclude-dir={vendor,public,tmp,doc,log,test,config/locales,files,coverage,spec,node_modules}
app/models/mailer.rb:567:                                :set_filter => 1, :assigned_to_id => 'me',
app/models/mailer.rb:570:      :set_filter => 1, :sort => 'due_date:asc',
app/models/query.rb:463:      params[:set_filter] = 1
app/controllers/issues_controller.rb:487:    return if params[:set_filter] && (params.key?(:op) || params.key?(:f))
app/controllers/issues_controller.rb:490:      params[:set_filter] = 1
app/controllers/issues_controller.rb:493:    if !params[:set_filter] && use_session && session[:issue_query]
app/controllers/queries_controller.rb:87:    redirect_to_items(:set_filter => 1)
app/controllers/projects_controller.rb:331:    return if params[:set_filter] && (params.key?(:op) || params.key?(:f))
app/controllers/projects_controller.rb:334:      params[:set_filter] = 1
app/views/calendars/show.html.erb:5:<%= hidden_field_tag 'set_filter', '1' %>
app/views/calendars/show.html.erb:29:  <%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 }, :class => 'icon icon-reload' %>
app/views/context_menus/issues.html.erb:146:  <li><%= context_menu_link l(:button_filter), _project_issues_path(@project, :set_filter => 1, :status_id => "*", :issue_id => @issue_ids.join(","), :c => @columns),
app/views/context_menus/issues.html.erb:163:  <li><%= copy_object_url_link(_project_issues_url(@project, set_filter: 1, status_id: '*', issue_id: @issue_ids.join(','))) %></li>
app/views/projects/show.html.erb:71:            <%= link_to tracker.name, project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id), :title => tracker.description %>
app/views/projects/show.html.erb:74:            <%= link_to @open_issues_by_tracker[tracker].to_i, project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id) %>
app/views/projects/show.html.erb:77:            <%= link_to (@total_issues_by_tracker[tracker].to_i - @open_issues_by_tracker[tracker].to_i), project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id, :status_id => 'c') %>
app/views/projects/show.html.erb:80:            <%= link_to @total_issues_by_tracker[tracker].to_i, project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id, :status_id => '*') %>
app/views/projects/show.html.erb:88:      <%= link_to l(:label_issue_view_all), project_issues_path(@project, :set_filter => 1) %>
app/views/versions/_issue_counts.html.erb:18:            <%= link_to(count[:group], project_issues_path(version.project, :set_filter => 1, :status_id => '*', :fixed_version_id => version, "#{criteria}_id" => count[:group])) %>
app/views/versions/_issue_counts.html.erb:20:            <%= link_to(l(:label_none), project_issues_path(version.project, :set_filter => 1, :status_id => '*', :fixed_version_id => version, "#{criteria}_id" => "!*")) %>
app/views/versions/show.html.erb:23:                                        project_issues_path(@version.project, :set_filter => 1, :status_id => '*', :fixed_version_id => @version.id, :c => [:tracker, :status, :subject, :estimated_hours], :t => [:estimated_hours]) %></td>
app/views/versions/show.html.erb:29:                                        project_time_entries_path(@version.project, :set_filter => 1, :"issue.fixed_version_id" => @version.id) %></td>
app/views/queries/_query_form.html.erb:1:<%= hidden_field_tag 'set_filter', '1' %>
app/views/queries/_query_form.html.erb:57:  <%= link_to l(:button_clear), { :set_filter => 1, :sort => '', :project_id => @project }, :class => 'icon icon-reload'  %>
app/views/imports/_issues_saved_objects.html.erb:7:<p><%= link_to l(:label_issue_view_all), issues_path(:set_filter => 1, :status_id => '*', :issue_id => saved_objects.map(&:id).join(',')) %></p>
app/views/welcome/robots.text.erb:15:Disallow: <%= url_for(issues_path) %>?*set_filter=
app/views/users/show.html.erb:42:        issues_path(:set_filter => 1, :assigned_to_id => assigned_to_ids, :sort => sort_cond) %>
app/views/users/show.html.erb:46:        issues_path(:set_filter => 1, :assigned_to_id => assigned_to_ids, :sort => sort_cond) %>
app/views/users/show.html.erb:50:        issues_path(:set_filter => 1, :status_id => 'c', :assigned_to_id => assigned_to_ids, :sort => sort_cond) %>
app/views/users/show.html.erb:54:        issues_path(:set_filter => 1, :status_id => '*', :assigned_to_id => assigned_to_ids, :sort => sort_cond) %>
app/views/users/show.html.erb:60:        issues_path(:set_filter => 1, :author_id => @user.id, :sort => sort_cond) %>
app/views/users/show.html.erb:64:        issues_path(:set_filter => 1, :author_id => @user.id, :sort => sort_cond) %>
app/views/users/show.html.erb:68:        issues_path(:set_filter => 1, :status_id => 'c', :author_id => @user.id, :sort => sort_cond) %>
app/views/users/show.html.erb:72:        issues_path(:set_filter => 1, :status_id => '*', :author_id => @user.id, :sort => sort_cond) %>
app/views/gantts/show.html.erb:11:<%= hidden_field_tag 'set_filter', '1' %>
app/views/gantts/show.html.erb:91:  <%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 },
app/helpers/queries_helper.rb:344:    elsif api_request? || params[:set_filter] || !use_session ||
app/helpers/queries_helper.rb:417:    tags = hidden_field_tag("set_filter", "1", :id => nil)
app/helpers/queries_helper.rb:475:          clear_link_param = {:set_filter => 1, :sort => '', :project_id => @project}
app/helpers/queries_helper.rb:498:  def link_to_clear_query(params = {:set_filter => 1, :sort => '', :project_id => @project})
app/helpers/reports_helper.rb:44:    parameters = {:set_filter => 1, :subproject_id => '!*', field => (row.id || '!*')}.merge(options)
app/helpers/versions_helper.rb:31:    options = {:fixed_version_id => version, :set_filter => 1}.merge(options)
app/helpers/issues_helper.rb:172:      link_to(total_issues, issues_path(issues_path_attr.merge({:set_filter => true, :status_id => '*'}))),
app/helpers/issues_helper.rb:180:        issues_path(issues_path_attr.merge({:set_filter => true, :status_id => 'c'}))
app/helpers/issues_helper.rb:189:        issues_path(issues_path_attr.merge({:set_filter => true, :status_id => 'o'}))

#2 Updated by Marius BALTEANU 9 months ago

Maybe it is enough to relax the set_filter if to not include the second condition (op and f params)?

#3 Updated by Yuichi HARADA 9 months ago

Marius BALTEANU wrote:

Maybe it is enough to relax the set_filter if to not include the second condition (op and f params)?

I think that it works properly if only set_filter is judged without the second condition. And I don't think the without_default parameter is needed.

#4 Updated by Marius BALTEANU 9 months ago

  • Related to Feature #7999: Issue Custom Query: Default Query added

#5 Updated by Marius BALTEANU 9 months ago

  • Related to deleted (Feature #7999: Issue Custom Query: Default Query)

#6 Updated by Marius BALTEANU 9 months ago

  • Related to Feature #7360: Issue custom query: default query per instance, project and user added

#7 Updated by Marius BALTEANU 9 months ago

  • Related to Feature #35795: Settings for global and user default custom ProjectQuery added

#8 Updated by Marius BALTEANU 9 months ago

  • Assignee set to Marius BALTEANU
  • Target version set to 5.0.0

#9 Updated by Marius BALTEANU 9 months ago

If we change as I proposed, then the without_default param doesn't make any sense anymore.

I'll wait for some more feedback before I commit this.

#10 Updated by Marius BALTEANU 7 months ago

  • Category set to Filters
  • Status changed from New to Closed
  • Resolution set to Fixed

Patch committed.

Also available in: Atom PDF