diff options
Diffstat (limited to 'app/services/issues/base_service.rb')
-rw-r--r-- | app/services/issues/base_service.rb | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/app/services/issues/base_service.rb b/app/services/issues/base_service.rb index 75ef9f735ab..05090efe260 100644 --- a/app/services/issues/base_service.rb +++ b/app/services/issues/base_service.rb @@ -53,6 +53,10 @@ module Issues params.delete(:issue_type) unless create_issue_type_allowed?(issue, params[:issue_type]) + if params[:work_item_type].present? && !create_issue_type_allowed?(project, params[:work_item_type].base_type) + params.delete(:work_item_type) + end + moved_issue = params.delete(:moved_issue) # Setting created_at, updated_at and iid is allowed only for admins and owners or @@ -103,8 +107,8 @@ module Issues def execute_hooks(issue, action = 'open', old_associations: {}) issue_data = Gitlab::Lazy.new { hook_data(issue, action, old_associations: old_associations) } hooks_scope = issue.confidential? ? :confidential_issue_hooks : :issue_hooks - issue.project.execute_hooks(issue_data, hooks_scope) - issue.project.execute_integrations(issue_data, hooks_scope) + issue.namespace.execute_hooks(issue_data, hooks_scope) + issue.namespace.execute_integrations(issue_data, hooks_scope) execute_incident_hooks(issue, issue_data) if issue.incident? end @@ -114,29 +118,12 @@ module Issues def execute_incident_hooks(issue, issue_data) issue_data[:object_kind] = 'incident' issue_data[:event_type] = 'incident' - issue.project.execute_integrations(issue_data, :incident_hooks) + issue.namespace.execute_integrations(issue_data, :incident_hooks) end def update_project_counter_caches?(issue) super || issue.confidential_changed? end - - def delete_milestone_closed_issue_counter_cache(milestone) - return unless milestone - - Milestones::ClosedIssuesCountService.new(milestone).delete_cache - end - - def delete_milestone_total_issue_counter_cache(milestone) - return unless milestone - - Milestones::IssuesCountService.new(milestone).delete_cache - end - - override :allowed_create_params - def allowed_create_params(params) - super(params).except(:work_item_type_id, :work_item_type) - end end end |