diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /app/controllers/dashboard | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'app/controllers/dashboard')
-rw-r--r-- | app/controllers/dashboard/snippets_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/dashboard/todos_controller.rb | 39 |
2 files changed, 28 insertions, 13 deletions
diff --git a/app/controllers/dashboard/snippets_controller.rb b/app/controllers/dashboard/snippets_controller.rb index 5a885349467..d72a5e44b9f 100644 --- a/app/controllers/dashboard/snippets_controller.rb +++ b/app/controllers/dashboard/snippets_controller.rb @@ -7,7 +7,7 @@ class Dashboard::SnippetsController < Dashboard::ApplicationController skip_cross_project_access_check :index - feature_category :snippets + feature_category :source_code_management def index @snippet_counts = Snippets::CountService diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index d2434d4b0ba..3005d19f8ed 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -3,6 +3,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController include ActionView::Helpers::NumberHelper include PaginatedCollection + include Gitlab::Utils::StrongMemoize before_action :authorize_read_project!, only: :index before_action :authorize_read_group!, only: :index @@ -64,19 +65,19 @@ class Dashboard::TodosController < Dashboard::ApplicationController def authorize_read_project! project_id = params[:project_id] - if project_id.present? - project = Project.find(project_id) - render_404 unless can?(current_user, :read_project, project) - end + return unless project_id.present? + + project = Project.find(project_id) + render_404 unless can?(current_user, :read_project, project) end def authorize_read_group! group_id = params[:group_id] - if group_id.present? - group = Group.find(group_id) - render_404 unless can?(current_user, :read_group, group) - end + return unless group_id.present? + + group = Group.find(group_id) + render_404 unless can?(current_user, :read_group, group) end def find_todos @@ -99,14 +100,28 @@ class Dashboard::TodosController < Dashboard::ApplicationController end def todo_params - aliased_action_id( + aliased_params( params.permit(:action_id, :author_id, :project_id, :type, :sort, :state, :group_id) ) end + strong_memoize_attr :todo_params + + def aliased_params(original_params) + alias_issue_type(original_params) + alias_action_id(original_params) + + original_params + end + + def alias_issue_type(original_params) + return unless original_params[:type] == Issue.name + + original_params[:type] = [Issue.name, WorkItem.name] + end - def aliased_action_id(original_params) - return original_params unless original_params[:action_id].to_i == ::Todo::MENTIONED + def alias_action_id(original_params) + return unless original_params[:action_id].to_i == ::Todo::MENTIONED - original_params.merge(action_id: [::Todo::MENTIONED, ::Todo::DIRECTLY_ADDRESSED]) + original_params[:action_id] = [::Todo::MENTIONED, ::Todo::DIRECTLY_ADDRESSED] end end |