diff options
author | Jarka Kadlecova <jarka@gitlab.com> | 2017-08-11 19:48:06 +0300 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-08-11 19:48:06 +0300 |
commit | d78037c246d14817937abbc4369e30ae12b022bc (patch) | |
tree | fca9b9516c635b30167ffd2614e6f51160b88ee4 /app/serializers | |
parent | 345df20870b718daa74c0177221c00cdec6083f3 (diff) |
Use UserNoteEntity instead of UserEntity for notes
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/note_entity.rb | 4 | ||||
-rw-r--r-- | app/serializers/user_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/user_note_entity.rb | 9 |
3 files changed, 11 insertions, 4 deletions
diff --git a/app/serializers/note_entity.rb b/app/serializers/note_entity.rb index f84343aa71a..e5295f5f34d 100644 --- a/app/serializers/note_entity.rb +++ b/app/serializers/note_entity.rb @@ -3,7 +3,7 @@ class NoteEntity < API::Entities::Note expose :type - expose :author, using: UserEntity + expose :author, using: UserNoteEntity expose :human_access do |note| note.project.team.human_max_access(note.author_id) @@ -15,7 +15,7 @@ class NoteEntity < API::Entities::Note expose :redacted_note_html, as: :note_html expose :last_edited_at, if: -> (note, _) { note.is_edited? } - expose :last_edited_by, using: UserEntity, if: -> (note, _) { note.is_edited? } + expose :last_edited_by, using: UserNoteEntity, if: -> (note, _) { note.is_edited? } expose :current_user do expose :can_edit do |note| diff --git a/app/serializers/user_entity.rb b/app/serializers/user_entity.rb index 3bb340065c4..876512b12dc 100644 --- a/app/serializers/user_entity.rb +++ b/app/serializers/user_entity.rb @@ -1,8 +1,6 @@ class UserEntity < API::Entities::UserBasic include RequestAwareEntity - unexpose :web_url - expose :path do |user| user_path(user) end diff --git a/app/serializers/user_note_entity.rb b/app/serializers/user_note_entity.rb new file mode 100644 index 00000000000..fbd87470380 --- /dev/null +++ b/app/serializers/user_note_entity.rb @@ -0,0 +1,9 @@ +class UserNoteEntity < API::Entities::UserBasic + include RequestAwareEntity + + unexpose :web_url + + expose :path do |user| + user_path(user) + end +end |