diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2018-04-03 16:03:00 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2018-04-03 16:03:00 +0000 |
commit | 65664c2eaeed853396c97a9b46e404c05209c42e (patch) | |
tree | e903e3afa6fe5c0f3492dc443776ebd1ce8ade57 /app/serializers/discussion_entity.rb | |
parent | 67ca10f33ec41e7cecac152e016aa2c0956a7586 (diff) | |
download | gitlab-ce-65664c2eaeed853396c97a9b46e404c05209c42e.tar.gz |
Refactor discussions/notes code
Diffstat (limited to 'app/serializers/discussion_entity.rb')
-rw-r--r-- | app/serializers/discussion_entity.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/serializers/discussion_entity.rb b/app/serializers/discussion_entity.rb index bbbcf6a97c1..718fb35e62d 100644 --- a/app/serializers/discussion_entity.rb +++ b/app/serializers/discussion_entity.rb @@ -4,7 +4,9 @@ class DiscussionEntity < Grape::Entity expose :id, :reply_id expose :expanded?, as: :expanded - expose :notes, using: NoteEntity + expose :notes do |discussion, opts| + request.note_entity.represent(discussion.notes, opts) + end expose :individual_note?, as: :individual_note expose :resolvable?, as: :resolvable @@ -12,7 +14,7 @@ class DiscussionEntity < Grape::Entity expose :resolve_path, if: -> (d, _) { d.resolvable? } do |discussion| resolve_project_merge_request_discussion_path(discussion.project, discussion.noteable, discussion.id) end - expose :resolve_with_issue_path do |discussion| + expose :resolve_with_issue_path, if: -> (d, _) { d.resolvable? } do |discussion| new_project_issue_path(discussion.project, merge_request_to_resolve_discussions_of: discussion.noteable.iid, discussion_to_resolve: discussion.id) end |