2020-10-24 23:57:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Projects::IncidentsController < Projects::ApplicationController
|
2021-01-03 14:25:43 +05:30
|
|
|
include IssuableActions
|
|
|
|
include Gitlab::Utils::StrongMemoize
|
|
|
|
|
|
|
|
before_action :authorize_read_issue!
|
|
|
|
before_action :load_incident, only: [:show]
|
2022-05-07 20:08:51 +05:30
|
|
|
before_action do
|
2022-08-13 15:12:31 +05:30
|
|
|
push_force_frontend_feature_flag(:work_items, @project&.work_items_feature_flag_enabled?)
|
2022-08-27 11:52:29 +05:30
|
|
|
push_force_frontend_feature_flag(:work_items_mvc_2, @project&.work_items_mvc_2_feature_flag_enabled?)
|
2022-08-13 15:12:31 +05:30
|
|
|
push_frontend_feature_flag(:work_items_hierarchy, @project)
|
2022-05-07 20:08:51 +05:30
|
|
|
end
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
feature_category :incident_management
|
2022-07-16 23:28:13 +05:30
|
|
|
urgency :low
|
2020-10-24 23:57:45 +05:30
|
|
|
|
|
|
|
def index
|
|
|
|
end
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def incident
|
|
|
|
strong_memoize(:incident) do
|
|
|
|
incident_finder
|
|
|
|
.execute
|
|
|
|
.inc_relations_for_view
|
|
|
|
.iid_in(params[:id])
|
|
|
|
.without_order
|
2022-10-11 01:57:18 +05:30
|
|
|
.take # rubocop:disable CodeReuse/ActiveRecord
|
2021-01-03 14:25:43 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def load_incident
|
|
|
|
@issue = incident # needed by rendered view
|
|
|
|
return render_404 unless can?(current_user, :read_issue, incident)
|
|
|
|
|
|
|
|
@noteable = incident
|
|
|
|
@note = incident.project.notes.new(noteable: issuable)
|
|
|
|
end
|
|
|
|
|
|
|
|
alias_method :issuable, :incident
|
|
|
|
|
|
|
|
def incident_finder
|
|
|
|
IssuesFinder.new(current_user, project_id: @project.id, issue_types: :incident)
|
|
|
|
end
|
|
|
|
|
|
|
|
def serializer
|
|
|
|
IssueSerializer.new(current_user: current_user, project: incident.project)
|
|
|
|
end
|
2020-10-24 23:57:45 +05:30
|
|
|
end
|
2022-05-07 20:08:51 +05:30
|
|
|
|
|
|
|
Projects::IncidentsController.prepend_mod
|