Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
cb4a09bb302e
Commit
4c8942f9
authored
Sep 13, 2017
by
Bob Van Landuyt
Browse files
Replace `full_path`, `path` & `web_url` with a single `relative_path`
parent
aebce4dd9c1a
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/serializers/group_child_entity.rb
View file @
cb4a09bb
...
...
@@ -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 @@ def edit_path
end
end
def
relative_path
if
project?
project_path
(
object
)
else
group_path
(
object
)
end
end
def
permission
return
unless
request
&
.
current_user
...
...
spec/serializers/group_child_entity_spec.rb
View file @
cb4a09bb
...
...
@@ -16,19 +16,17 @@
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment