diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-06-26 19:39:40 -0500 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-07-21 22:35:25 +0300 |
commit | cf926f6b7f412c194a47329f101dee1adc6d19dc (patch) | |
tree | edfd3c83e6fe14e2344cfb2b60e31a331e2a9ef3 /app/serializers | |
parent | ebf915511359c336b99c1127c5b902f8757ba5e0 (diff) | |
download | gitlab-ce-cf926f6b7f412c194a47329f101dee1adc6d19dc.tar.gz |
Remove duplicate attributes from discussion entity and move note.can_edit into note.current_user
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/discussion_entity.rb | 10 | ||||
-rw-r--r-- | app/serializers/note_entity.rb | 6 |
2 files changed, 4 insertions, 12 deletions
diff --git a/app/serializers/discussion_entity.rb b/app/serializers/discussion_entity.rb index cb6c3c23807..0a92e3f8167 100644 --- a/app/serializers/discussion_entity.rb +++ b/app/serializers/discussion_entity.rb @@ -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 diff --git a/app/serializers/note_entity.rb b/app/serializers/note_entity.rb index 7a49ec4ef55..53b3ed41940 100644 --- a/app/serializers/note_entity.rb +++ b/app/serializers/note_entity.rb @@ -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| |