summaryrefslogtreecommitdiff
path: root/app/controllers/dashboard_controller.rb
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2018-03-23 15:27:15 +0100
committerWinnie Hellmann <winnie@gitlab.com>2018-04-03 20:19:09 +0200
commitc1b71e2fa1e49da82b15ee7f12148a372face09c (patch)
treec88dbf140e95c5d8f3cd6ea201e058a4cd1a1c0b /app/controllers/dashboard_controller.rb
parent59a158955e1ae09420ad05e53782e0dbc512e9c8 (diff)
downloadgitlab-ce-c1b71e2fa1e49da82b15ee7f12148a372face09c.tar.gz
Check if at least one filter is set on dashboard
When listing issues and merge requests on dasboard page, make sure that at least one filter is enabled. User's id is used in search autocomplete widget instead of username, which allows presetting user in filter dropdowns. Related to #43246
Diffstat (limited to 'app/controllers/dashboard_controller.rb')
-rw-r--r--app/controllers/dashboard_controller.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
index 280ed93faf8..d228956d8e3 100644
--- a/app/controllers/dashboard_controller.rb
+++ b/app/controllers/dashboard_controller.rb
@@ -2,9 +2,17 @@ class DashboardController < Dashboard::ApplicationController
include IssuesAction
include MergeRequestsAction
+ FILTER_PARAMS = [
+ :author_id,
+ :assignee_id,
+ :milestone_title,
+ :label_name
+ ].freeze
+
before_action :event_filter, only: :activity
before_action :projects, only: [:issues, :merge_requests]
before_action :set_show_full_reference, only: [:issues, :merge_requests]
+ before_action :check_filters_presence, only: [:issues, :merge_requests]
respond_to :html
@@ -39,4 +47,10 @@ class DashboardController < Dashboard::ApplicationController
def set_show_full_reference
@show_full_reference = true
end
+
+ def check_filters_presence
+ @no_filters_set = FILTER_PARAMS.none? { |k| params.key?(k) }
+
+ render action: action_name if @no_filters_set
+ end
end