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
cf926f6b
Commit
cf926f6b
authored
Jun 26, 2017
by
Douwe Maan
Committed by
Fatih Acet
Jul 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove duplicate attributes from discussion entity and move note.can_edit into note.current_user
parent
ebf91551
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
12 deletions
+4
-12
app/serializers/discussion_entity.rb
app/serializers/discussion_entity.rb
+0
-10
app/serializers/note_entity.rb
app/serializers/note_entity.rb
+4
-2
No files found.
app/serializers/discussion_entity.rb
View file @
cf926f6b
...
...
@@ -3,18 +3,8 @@ class DiscussionEntity < Grape::Entity
expose
:id
,
:reply_id
expose
:expanded?
,
as: :expanded
expose
:author
,
using:
UserEntity
expose
:created_at
expose
:last_updated_at
,
if:
->
(
discussion
,
_
)
{
discussion
.
updated?
}
expose
:last_updated_by
,
if:
->
(
discussion
,
_
)
{
discussion
.
updated?
},
using:
UserEntity
expose
:notes
,
using:
NoteEntity
expose
:individual_note?
,
as: :individual_note
expose
:can_reply
do
|
discussion
|
can?
(
request
.
current_user
,
:create_note
,
discussion
.
project
)
end
end
app/serializers/note_entity.rb
View file @
cf926f6b
...
...
@@ -17,8 +17,10 @@ class NoteEntity < API::Entities::Note
expose
:last_edited_at
,
if:
->
(
note
,
_
)
{
note
.
is_edited?
}
expose
:last_edited_by
,
using:
UserEntity
,
if:
->
(
note
,
_
)
{
note
.
is_edited?
}
expose
:can_edit
do
|
note
|
Ability
.
can_edit_note?
(
request
.
current_user
,
note
)
expose
:current_user
do
expose
:can_edit
do
|
note
|
Ability
.
can_edit_note?
(
request
.
current_user
,
note
)
end
end
expose
:system_note_icon_name
,
if:
->
(
note
,
_
)
{
note
.
system?
}
do
|
note
|
...
...
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