Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
4c8942f9
Commit
4c8942f9
authored
Sep 13, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace `full_path`, `path` & `web_url` with a single `relative_path`
parent
1fb49b87
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
app/serializers/group_child_entity.rb
app/serializers/group_child_entity.rb
+9
-1
spec/serializers/group_child_entity_spec.rb
spec/serializers/group_child_entity_spec.rb
+2
-4
No files found.
app/serializers/group_child_entity.rb
View file @
4c8942f9
...
...
@@ -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
...
...
spec/serializers/group_child_entity_spec.rb
View file @
4c8942f9
...
...
@@ -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
...
...
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