Provide corrections from preliminary review

This commit:

* fixes superfluous and invalid interpolation of project and user link titles
* uses revision getter consistently
* adds `_link/revisions` to work packages
pull/3285/head
Oliver Günther 9 years ago
parent da9771ae1b
commit 6f5c489b82
  1. 4
      lib/api/v3/repositories/revision_representer.rb
  2. 4
      lib/api/v3/repositories/revisions_api.rb
  3. 4
      lib/api/v3/utilities/path_helper.rb
  4. 6
      lib/api/v3/work_packages/work_package_representer.rb

@ -41,14 +41,14 @@ module API
link :project do
{
href: api_v3_paths.project(represented.project.id),
title: "#{represented.project.name}"
title: represented.project.name
}
end
link :author do
{
href: api_v3_paths.user(represented.user.id),
title: "#{represented.user.name} - #{represented.user.login}"
title: represented.user.name
} unless represented.user.nil?
end

@ -38,14 +38,14 @@ module API
attr_reader :revision
def revision_representer
RevisionRepresenter.new(@revision)
RevisionRepresenter.new(revision)
end
end
before do
@revision = Changeset.find(params[:id])
authorize(:view_changesets, context: @revision.project) do
authorize(:view_changesets, context: revision.project) do
raise API::Errors::NotFound.new
end
end

@ -204,6 +204,10 @@ module API
"#{work_package_relations(work_package_id)}/#{id}"
end
def self.work_package_revisions(id)
"#{work_package(id)}/revisions"
end
def self.work_package_schema(project_id, type_id)
"#{root}/work_packages/schemas/#{project_id}-#{type_id}"
end

@ -128,6 +128,12 @@ module API
} if current_user_allowed_to(:add_work_package_watchers, context: represented.project)
end
link :revisions do
{
href: api_v3_paths.work_package_revisions(represented.id)
} if current_user_allowed_to(:view_changesets, context: represented.project)
end
link :watch do
{
href: api_v3_paths.work_package_watchers(represented.id),

Loading…
Cancel
Save