Commit d3e62ab7 authored by Sean Arnold's avatar Sean Arnold

Fix todo API when used with Alerts

- Add correctly named route
- Allow Todos to work with scoped models

Changelog: fixed
parent c12b32b5
...@@ -360,6 +360,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -360,6 +360,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get 'details', on: :member get 'details', on: :member
end end
resources :alert_management, only: [], as: 'alert_management_alert' do
get '', on: :member, action: :details, as: ''
end
get 'work_items/*work_items_path' => 'work_items#index', as: :work_items get 'work_items/*work_items_path' => 'work_items#index', as: :work_items
resource :tracing, only: [:show] resource :tracing, only: [:show]
......
# frozen_string_literal: true
module API
module Entities
module AlertManagement
class Alert < Grape::Entity
expose :iid
expose :title
end
end
end
end
...@@ -33,7 +33,7 @@ module API ...@@ -33,7 +33,7 @@ module API
def todo_target_url(todo) def todo_target_url(todo)
return design_todo_target_url(todo) if todo.for_design? return design_todo_target_url(todo) if todo.for_design?
target_type = todo.target_type.underscore target_type = todo.target_type.constantize.model_name.param_key
target_url = "#{todo.resource_parent.class.to_s.underscore}_#{target_type}_url" target_url = "#{todo.resource_parent.class.to_s.underscore}_#{target_type}_url"
Gitlab::Routing Gitlab::Routing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment