Commit f8ea52c3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Remove thread vars usage from API notes and mr's

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent a7be3dfa
......@@ -5,7 +5,7 @@ class NoteObserver < BaseObserver
# Skip system notes, like status changes and cross-references.
# Skip wall notes to prevent spamming of dashboard
if note.noteable_type.present? && !note.system
event_service.leave_note(note, current_user)
event_service.leave_note(note, note.author)
end
unless note.system?
......@@ -18,6 +18,6 @@ class NoteObserver < BaseObserver
end
def after_update(note)
note.notice_added_references(note.project, current_user)
note.notice_added_references(note.project, note.author)
end
end
......@@ -184,7 +184,6 @@ module API
# POST /projects/:id/merge_request/:merge_request_id/comments
#
post ":id/merge_request/:merge_request_id/comments" do
set_current_user_for_thread do
required_attributes! [:note]
merge_request = user_project.merge_requests.find(params[:merge_request_id])
......@@ -198,7 +197,5 @@ module API
end
end
end
end
end
end
......@@ -41,7 +41,6 @@ module API
# Example Request:
# POST /projects/:id/notes
post ":id/notes" do
set_current_user_for_thread do
required_attributes! [:body]
@note = user_project.notes.new(note: params[:body])
......@@ -55,7 +54,6 @@ module API
not_found!
end
end
end
NOTEABLE_TYPES.each do |noteable_type|
noteables_str = noteable_type.to_s.underscore.pluralize
......@@ -99,7 +97,6 @@ module API
# POST /projects/:id/issues/:noteable_id/notes
# POST /projects/:id/snippets/:noteable_id/notes
post ":id/#{noteables_str}/:#{noteable_id_str}/notes" do
set_current_user_for_thread do
required_attributes! [:body]
@noteable = user_project.send(:"#{noteables_str}").find(params[:"#{noteable_id_str}"])
......@@ -116,5 +113,4 @@ module API
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment