Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/v3/notes.rb')
-rw-r--r--lib/api/v3/notes.rb48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/api/v3/notes.rb b/lib/api/v3/notes.rb
index 0796bb62e68..a3bb2d86e3a 100644
--- a/lib/api/v3/notes.rb
+++ b/lib/api/v3/notes.rb
@@ -5,7 +5,11 @@ module API
before { authenticate! }
+<<<<<<< HEAD
NOTEABLE_TYPES = [Issue, MergeRequest, Snippet].freeze
+=======
+ NOTEABLE_TYPES = [Issue, MergeRequest, Snippet]
+>>>>>>> 629355a06c... WIP
params do
requires :id, type: String, desc: 'The ID of a project'
@@ -15,7 +19,11 @@ module API
noteables_str = noteable_type.to_s.underscore.pluralize
desc 'Get a list of project +noteable+ notes' do
+<<<<<<< HEAD
success ::API::V3::Entities::Note
+=======
+ success ::API::Entities::Note
+>>>>>>> 629355a06c... WIP
end
params do
requires :noteable_id, type: Integer, desc: 'The ID of the noteable'
@@ -36,14 +44,22 @@ module API
# array returned, but this is really a edge-case.
paginate(noteable.notes).
reject { |n| n.cross_reference_not_visible_for?(current_user) }
+<<<<<<< HEAD
present notes, with: ::API::V3::Entities::Note
+=======
+ present notes, with: ::API::Entities::Note
+>>>>>>> 629355a06c... WIP
else
not_found!("Notes")
end
end
desc 'Get a single +noteable+ note' do
+<<<<<<< HEAD
success ::API::V3::Entities::Note
+=======
+ success ::API::Entities::Note
+>>>>>>> 629355a06c... WIP
end
params do
requires :note_id, type: Integer, desc: 'The ID of a note'
@@ -55,14 +71,22 @@ module API
can_read_note = can?(current_user, noteable_read_ability_name(noteable), noteable) && !note.cross_reference_not_visible_for?(current_user)
if can_read_note
+<<<<<<< HEAD
present note, with: ::API::V3::Entities::Note
+=======
+ present note, with: ::API::Entities::Note
+>>>>>>> 629355a06c... WIP
else
not_found!("Note")
end
end
desc 'Create a new +noteable+ note' do
+<<<<<<< HEAD
success ::API::V3::Entities::Note
+=======
+ success ::API::Entities::Note
+>>>>>>> 629355a06c... WIP
end
params do
requires :noteable_id, type: Integer, desc: 'The ID of the noteable'
@@ -84,8 +108,14 @@ module API
end
note = ::Notes::CreateService.new(user_project, current_user, opts).execute
+<<<<<<< HEAD
if note.valid?
present note, with: ::API::V3::Entities.const_get(note.class.name)
+=======
+
+ if note.valid?
+ present note, with: Entities::const_get(note.class.name)
+>>>>>>> 629355a06c... WIP
else
not_found!("Note #{note.errors.messages}")
end
@@ -95,7 +125,11 @@ module API
end
desc 'Update an existing +noteable+ note' do
+<<<<<<< HEAD
success ::API::V3::Entities::Note
+=======
+ success ::API::Entities::Note
+>>>>>>> 629355a06c... WIP
end
params do
requires :noteable_id, type: Integer, desc: 'The ID of the noteable'
@@ -114,14 +148,22 @@ module API
note = ::Notes::UpdateService.new(user_project, current_user, opts).execute(note)
if note.valid?
+<<<<<<< HEAD
present note, with: ::API::V3::Entities::Note
+=======
+ present note, with: ::API::Entities::Note
+>>>>>>> 629355a06c... WIP
else
render_api_error!("Failed to save note #{note.errors.messages}", 400)
end
end
desc 'Delete a +noteable+ note' do
+<<<<<<< HEAD
success ::API::V3::Entities::Note
+=======
+ success ::API::Entities::Note
+>>>>>>> 629355a06c... WIP
end
params do
requires :noteable_id, type: Integer, desc: 'The ID of the noteable'
@@ -131,9 +173,15 @@ module API
note = user_project.notes.find(params[:note_id])
authorize! :admin_note, note
+<<<<<<< HEAD
::Notes::DestroyService.new(user_project, current_user).execute(note)
present note, with: ::API::V3::Entities::Note
+=======
+ ::Notes::DeleteService.new(user_project, current_user).execute(note)
+
+ present note, with: ::API::Entities::Note
+>>>>>>> 629355a06c... WIP
end
end
end