Commit 3ff3eda6 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'trizzi-master-patch-13966' into 'master'

Add tracking for additional NuGet events

See merge request gitlab-org/gitlab!27438
parents d2e8002c 4ffe3ee7
......@@ -67,6 +67,8 @@ module API
get 'index', format: :json do
authorize_read_package!(authorized_user_project)
track_event('nuget_service_index')
present ::Packages::Nuget::ServiceIndexPresenter.new(authorized_user_project),
with: EE::API::Entities::Nuget::ServiceIndex
end
......@@ -166,6 +168,8 @@ module API
not_found!('Package') unless package_file
track_event('pull_package')
# nuget and dotnet don't support 302 Moved status codes, supports_direct_download has to be set to false
present_carrierwave_file!(package_file.file, supports_direct_download: false)
end
......@@ -196,6 +200,8 @@ module API
.new(authorized_user_project, params[:q], search_options)
.execute
track_event('search_package')
present ::Packages::Nuget::SearchResultsPresenter.new(search),
with: EE::API::Entities::Nuget::SearchResults
end
......
......@@ -36,6 +36,8 @@ RSpec.shared_examples 'process nuget service index request' do |user_type, statu
it_behaves_like 'returning response status', status
it_behaves_like 'a gitlab tracking event', described_class.name, 'nuget_service_index'
it 'returns a valid json response' do
subject
......@@ -280,6 +282,8 @@ RSpec.shared_examples 'process nuget download content request' do |user_type, st
it_behaves_like 'returning response status', status
it_behaves_like 'a gitlab tracking event', described_class.name, 'pull_package'
it 'returns a valid package archive' do
subject
......@@ -328,6 +332,8 @@ RSpec.shared_examples 'process nuget search request' do |user_type, status, add_
it_behaves_like 'returns a valid json search response', status, 4, [1, 5, 5, 1]
it_behaves_like 'a gitlab tracking event', described_class.name, 'search_package'
context 'with skip set to 2' do
let(:skip) { 2 }
......
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