2018-09-25 23:45:43 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-08 04:29:19 -04:00
|
|
|
class Projects::TodosController < Projects::ApplicationController
|
2018-07-16 09:35:19 -04:00
|
|
|
include Gitlab::Utils::StrongMemoize
|
|
|
|
include TodosActions
|
2018-07-11 12:33:24 -04:00
|
|
|
|
2018-07-16 09:35:19 -04:00
|
|
|
before_action :authenticate_user!, only: [:create]
|
2018-07-11 12:33:24 -04:00
|
|
|
|
2016-06-08 04:29:19 -04:00
|
|
|
private
|
2016-06-09 03:50:18 -04:00
|
|
|
|
2016-06-08 04:29:19 -04:00
|
|
|
def issuable
|
2018-07-16 09:35:19 -04:00
|
|
|
strong_memoize(:issuable) do
|
2016-06-08 04:29:19 -04:00
|
|
|
case params[:issuable_type]
|
|
|
|
when "issue"
|
2016-11-18 08:51:52 -05:00
|
|
|
IssuesFinder.new(current_user, project_id: @project.id).find(params[:issuable_id])
|
2016-06-08 04:29:19 -04:00
|
|
|
when "merge_request"
|
2016-11-29 08:47:43 -05:00
|
|
|
MergeRequestsFinder.new(current_user, project_id: @project.id).find(params[:issuable_id])
|
2016-06-08 04:29:19 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|