2018-09-26 03:45:43 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-08 08:29:19 +00:00
|
|
|
class Projects::TodosController < Projects::ApplicationController
|
2018-07-16 13:35:19 +00:00
|
|
|
include Gitlab::Utils::StrongMemoize
|
|
|
|
include TodosActions
|
2018-07-11 16:33:24 +00:00
|
|
|
|
2018-07-16 13:35:19 +00:00
|
|
|
before_action :authenticate_user!, only: [:create]
|
2018-07-11 16:33:24 +00:00
|
|
|
|
2021-10-27 15:13:41 +00:00
|
|
|
feature_category :team_planning
|
2020-10-08 18:08:32 +00:00
|
|
|
|
2016-06-08 08:29:19 +00:00
|
|
|
private
|
2016-06-09 07:50:18 +00:00
|
|
|
|
2016-06-08 08:29:19 +00:00
|
|
|
def issuable
|
2018-07-16 13:35:19 +00:00
|
|
|
strong_memoize(:issuable) do
|
2016-06-08 08:29:19 +00:00
|
|
|
case params[:issuable_type]
|
|
|
|
when "issue"
|
2016-11-18 13:51:52 +00:00
|
|
|
IssuesFinder.new(current_user, project_id: @project.id).find(params[:issuable_id])
|
2016-06-08 08:29:19 +00:00
|
|
|
when "merge_request"
|
2016-11-29 13:47:43 +00:00
|
|
|
MergeRequestsFinder.new(current_user, project_id: @project.id).find(params[:issuable_id])
|
2020-08-27 18:10:29 +00:00
|
|
|
when "design"
|
|
|
|
issue = IssuesFinder.new(current_user, project_id: @project.id).find(params[:issue_id])
|
|
|
|
DesignManagement::DesignsFinder.new(issue, current_user).find(params[:issuable_id])
|
2016-06-08 08:29:19 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|