BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
12 deletions
+4
-12
discussion_entity.rb
app/serializers/discussion_entity.rb
+0
-10
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