diff options
author | Heinrich Lee Yu <hleeyu@gmail.com> | 2018-11-09 22:29:45 +0800 |
---|---|---|
committer | Heinrich Lee Yu <hleeyu@gmail.com> | 2018-11-15 01:12:07 +0800 |
commit | 2a5319832454fe40cfea151dd7b9e2aa520b3450 (patch) | |
tree | 4e996385d7f70ead102fe361f28e43ada80c30da /app/controllers/dashboard_controller.rb | |
parent | 2ade9b4479d7ce1f9b1bebd1e9ca47efb4b6f423 (diff) | |
download | gitlab-ce-2a5319832454fe40cfea151dd7b9e2aa520b3450.tar.gz |
Refactor whitelisting of filter params
Diffstat (limited to 'app/controllers/dashboard_controller.rb')
-rw-r--r-- | app/controllers/dashboard_controller.rb | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 5076c3da324..4ce9be44403 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -4,17 +4,6 @@ class DashboardController < Dashboard::ApplicationController include IssuesAction include MergeRequestsAction - FILTER_PARAMS = [ - # author_id and assignee_id are kept so old RSS links still work - :author_id, - :assignee_id, - :author_username, - :assignee_username, - :milestone_title, - :label_name, - :my_reaction_emoji - ].freeze - before_action :event_filter, only: :activity before_action :projects, only: [:issues, :merge_requests] before_action :set_show_full_reference, only: [:issues, :merge_requests] @@ -55,10 +44,13 @@ class DashboardController < Dashboard::ApplicationController end def check_filters_presence! - @no_filters_set = FILTER_PARAMS.none? { |k| params.key?(k) } + @no_filters_set = finder_type.scalar_params.none? { |k| params.key?(k) } return unless @no_filters_set + # Call to set selected `state` and `sort` options in view + finder_options + respond_to do |format| format.html { render } format.atom { head :bad_request } |