diff options
author | Nick Thomas <nick@gitlab.com> | 2018-04-11 00:55:02 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-04-11 00:55:02 +0100 |
commit | 3f73bdd837f9803b75eca484a0a0615db6c58c80 (patch) | |
tree | 0bd2c99d9198bfa22e7a29f375131f940033da7b /app/serializers/project_note_entity.rb | |
parent | b594ab949d1a2ceb9d949ff2641679fbdf273452 (diff) | |
parent | 37a5632483b67ddcfa4c535cc911319b25f01fb5 (diff) | |
download | gitlab-ce-xterm-npm.tar.gz |
Merge branch 'master' into xterm-npmxterm-npm
Diffstat (limited to 'app/serializers/project_note_entity.rb')
-rw-r--r-- | app/serializers/project_note_entity.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/serializers/project_note_entity.rb b/app/serializers/project_note_entity.rb new file mode 100644 index 00000000000..e541bfbee8d --- /dev/null +++ b/app/serializers/project_note_entity.rb @@ -0,0 +1,25 @@ +class ProjectNoteEntity < NoteEntity + expose :human_access do |note| + note.project.team.human_max_access(note.author_id) + end + + expose :toggle_award_path, if: -> (note, _) { note.emoji_awardable? } do |note| + toggle_award_emoji_project_note_path(note.project, note.id) + end + + expose :path do |note| + project_note_path(note.project, note) + 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 :delete_attachment_path, if: -> (note, _) { note.attachment? } do |note| + delete_attachment_project_note_path(note.project, note) + end +end |