summaryrefslogtreecommitdiff
path: root/app/controllers/dashboard
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /app/controllers/dashboard
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'app/controllers/dashboard')
-rw-r--r--app/controllers/dashboard/milestones_controller.rb32
-rw-r--r--app/controllers/dashboard/todos_controller.rb10
2 files changed, 14 insertions, 28 deletions
diff --git a/app/controllers/dashboard/milestones_controller.rb b/app/controllers/dashboard/milestones_controller.rb
index d34a07324da..14f9a026688 100644
--- a/app/controllers/dashboard/milestones_controller.rb
+++ b/app/controllers/dashboard/milestones_controller.rb
@@ -1,48 +1,32 @@
# frozen_string_literal: true
class Dashboard::MilestonesController < Dashboard::ApplicationController
- include MilestoneActions
-
before_action :projects
before_action :groups, only: :index
- before_action :milestone, only: [:show, :merge_requests, :participants, :labels]
def index
respond_to do |format|
format.html do
- @milestone_states = Milestone.states_count(@projects.select(:id), @groups.select(:id))
- @milestones = Kaminari.paginate_array(milestones).page(params[:page])
+ @milestone_states = Milestone.states_count(@projects.select(:id), groups.select(:id))
+ @milestones = milestones.page(params[:page])
end
format.json do
- render json: milestones
+ render json: milestones.to_json(only: [:id, :title], methods: :name)
end
end
end
- def show
- end
-
private
- def group_milestones
- DashboardGroupMilestone.build_collection(groups, params)
- end
-
- # See [#39545](https://gitlab.com/gitlab-org/gitlab-foss/issues/39545) for info about the deprecation of dynamic milestones
- def dynamic_milestones
- DashboardMilestone.build_collection(@projects, params)
- end
-
def milestones
- @milestones = group_milestones + dynamic_milestones
- end
-
- def milestone
- @milestone = DashboardMilestone.build(@projects, params[:title])
- render_404 unless @milestone
+ MilestonesFinder.new(search_params).execute
end
def groups
@groups ||= GroupsFinder.new(current_user, all_available: false).execute
end
+
+ def search_params
+ params.permit(:state, :search_title).merge(group_ids: groups, project_ids: projects)
+ end
end
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb
index ebee8e9094e..8a8064b24c2 100644
--- a/app/controllers/dashboard/todos_controller.rb
+++ b/app/controllers/dashboard/todos_controller.rb
@@ -17,7 +17,9 @@ class Dashboard::TodosController < Dashboard::ApplicationController
end
def destroy
- TodoService.new.mark_todos_as_done_by_ids(params[:id], current_user)
+ todo = current_user.todos.find(params[:id])
+
+ TodoService.new.resolve_todo(todo, current_user, resolved_by_action: :mark_done)
respond_to do |format|
format.html do
@@ -31,7 +33,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
end
def destroy_all
- updated_ids = TodoService.new.mark_todos_as_done(@todos, current_user)
+ updated_ids = TodoService.new.resolve_todos(@todos, current_user, resolved_by_action: :mark_all_done)
respond_to do |format|
format.html { redirect_to dashboard_todos_path, status: :found, notice: _('Everything on your to-do list is marked as done.') }
@@ -41,13 +43,13 @@ class Dashboard::TodosController < Dashboard::ApplicationController
end
def restore
- TodoService.new.mark_todos_as_pending_by_ids(params[:id], current_user)
+ TodoService.new.restore_todo(current_user.todos.find(params[:id]), current_user)
render json: todos_counts
end
def bulk_restore
- TodoService.new.mark_todos_as_pending_by_ids(params[:ids], current_user)
+ TodoService.new.restore_todos(current_user.todos.for_ids(params[:ids]), current_user)
render json: todos_counts
end