Commit 4c8942f9 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Replace `full_path`, `path` & `web_url` with a single `relative_path`

parent 1fb49b87
......@@ -2,7 +2,7 @@ class GroupChildEntity < Grape::Entity
include ActionView::Helpers::NumberHelper
include RequestAwareEntity
expose :id, :name, :path, :description, :visibility, :full_name, :full_path, :web_url,
expose :id, :name, :description, :visibility, :full_name, :relative_path,
:created_at, :updated_at, :can_edit, :type, :avatar_url, :permission, :edit_path
def project?
......@@ -31,6 +31,14 @@ class GroupChildEntity < Grape::Entity
end
end
def relative_path
if project?
project_path(object)
else
group_path(object)
end
end
def permission
return unless request&.current_user
......
......@@ -16,19 +16,17 @@ describe GroupChildEntity do
end
%w[id
path
full_name
full_path
avatar_url
name
description
web_url
visibility
type
can_edit
visibility
edit_path
permission].each do |attribute|
permission
relative_path].each do |attribute|
it "includes #{attribute}" do
expect(json[attribute.to_sym]).to be_present
end
......
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