summaryrefslogtreecommitdiff
path: root/app/serializers/note_entity.rb
diff options
context:
space:
mode:
authorClement Ho <clemmakesapps@gmail.com>2018-02-28 15:40:52 +0000
committerClement Ho <clemmakesapps@gmail.com>2018-02-28 15:40:52 +0000
commitb5b8dc83cc1bb271877c79532ecfb555540672a7 (patch)
tree190f6cd6991cbfbabbd670a7aac5ff36eb1a64bb /app/serializers/note_entity.rb
parentdeef09cd1f0dbe5cab5095ff02f19a5c3588cb91 (diff)
parentff2f57da791890957fe97efd46f5c34f270a0c46 (diff)
downloadgitlab-ce-dispatcher-cycle-analytics.tar.gz
Merge branch 'master' into 'dispatcher-cycle-analytics'dispatcher-cycle-analytics
# Conflicts: # config/webpack.config.js
Diffstat (limited to 'app/serializers/note_entity.rb')
-rw-r--r--app/serializers/note_entity.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/serializers/note_entity.rb b/app/serializers/note_entity.rb
index 7d50e0ff10d..4ccf0bca476 100644
--- a/app/serializers/note_entity.rb
+++ b/app/serializers/note_entity.rb
@@ -23,6 +23,10 @@ class NoteEntity < API::Entities::Note
end
end
+ expose :resolved?, as: :resolved
+ expose :resolvable?, as: :resolvable
+ expose :resolved_by, using: NoteUserEntity
+
expose :system_note_icon_name, if: -> (note, _) { note.system? } do |note|
SystemNoteHelper.system_note_icon_name(note)
end
@@ -53,6 +57,14 @@ class NoteEntity < API::Entities::Note
end
end
+ expose :resolve_path, if: -> (note, _) { note.part_of_discussion? && note.resolvable? } do |note|
+ resolve_project_merge_request_discussion_path(note.project, note.noteable, note.discussion_id)
+ end
+
+ expose :resolve_with_issue_path, if: -> (note, _) { note.part_of_discussion? && note.resolvable? } do |note|
+ new_project_issue_path(note.project, merge_request_to_resolve_discussions_of: note.noteable.iid, discussion_to_resolve: note.discussion_id)
+ end
+
expose :attachment, using: NoteAttachmentEntity, if: -> (note, _) { note.attachment? }
expose :delete_attachment_path, if: -> (note, _) { note.attachment? } do |note|
delete_attachment_project_note_path(note.project, note)