Fixed broken links in WP representer

pull/1756/head
Marek Takac 10 years ago
parent 617b6a35a7
commit 547ef3f8f5
  1. 2
      lib/api/v3/users/user_representer.rb
  2. 8
      lib/api/v3/work_packages/work_package_representer.rb

@ -57,7 +57,7 @@ module API
link :removeWatcher do
{
href: "#{root_path}/api/v3/work_packages/#{@work_package.id}/watchers/#{represented.model.id}",
href: "#{root_path}api/v3/work_packages/#{@work_package.id}/watchers/#{represented.model.id}",
method: :delete,
title: 'Remove watcher'
} if @work_package && current_user_allowed_to(:delete_work_package_watchers, @work_package)

@ -58,7 +58,7 @@ module API
link :update do
{
href: "/api/v3/work_packages/#{represented.model.id}",
href: "#{root_path}api/v3/work_packages/#{represented.model.id}",
method: :patch,
title: "Update #{represented.subject}"
} if current_user_allowed_to(:edit_work_packages, represented.model)
@ -130,7 +130,7 @@ module API
link :addRelation do
{
href: "#{root_path}/api/v3/work_packages/#{represented.model.id}/relations",
href: "#{root_path}api/v3/work_packages/#{represented.model.id}/relations",
method: :post,
title: 'Add relation'
} if current_user_allowed_to(:manage_work_package_relations, represented.model)
@ -146,14 +146,14 @@ module API
link :parent do
{
href: "#{root_path}/api/v3/work_packages/#{represented.model.parent.id}",
href: "#{root_path}api/v3/work_packages/#{represented.model.parent.id}",
title: represented.model.parent.subject
} unless represented.model.parent.nil? || !represented.model.parent.visible?
end
links :children do
visible_children.map do |child|
{ href: "#{root_path}/api/v3/work_packages/#{child.id}", title: child.subject }
{ href: "#{root_path}api/v3/work_packages/#{child.id}", title: child.subject }
end unless visible_children.empty?
end

Loading…
Cancel
Save