Commit 8b96dd43 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'namespace-onboarding-action-git-read' into 'master'

Add git read namespace onboarding action

See merge request gitlab-org/gitlab!49007
parents c271ea5c 96773f26
...@@ -80,6 +80,8 @@ module Repositories ...@@ -80,6 +80,8 @@ module Repositories
return if Gitlab::Database.read_only? return if Gitlab::Database.read_only?
return unless repo_type.project? return unless repo_type.project?
OnboardingProgressService.new(project.namespace).execute(action: :git_read)
if Feature.enabled?(:project_statistics_sync, project, default_enabled: true) if Feature.enabled?(:project_statistics_sync, project, default_enabled: true)
Projects::FetchStatisticsIncrementService.new(project).execute Projects::FetchStatisticsIncrementService.new(project).execute
else else
......
...@@ -7,7 +7,8 @@ class NamespaceOnboardingAction < ApplicationRecord ...@@ -7,7 +7,8 @@ class NamespaceOnboardingAction < ApplicationRecord
ACTIONS = { ACTIONS = {
subscription_created: 1, subscription_created: 1,
git_write: 2 git_write: 2,
git_read: 4
}.freeze }.freeze
enum action: ACTIONS enum action: ACTIONS
......
# frozen_string_literal: true
class OnboardingProgressService
def initialize(namespace)
@namespace = namespace
end
def execute(action:)
NamespaceOnboardingAction.create_action(@namespace, action)
end
end
...@@ -167,6 +167,14 @@ RSpec.describe Repositories::GitHttpController do ...@@ -167,6 +167,14 @@ RSpec.describe Repositories::GitHttpController do
Projects::DailyStatisticsFinder.new(container).total_fetch_count Projects::DailyStatisticsFinder.new(container).total_fetch_count
}.from(0).to(1) }.from(0).to(1)
end end
it 'records a namespace onboarding progress action' do
expect_next_instance_of(OnboardingProgressService) do |service|
expect(service).to receive(:execute).with(action: :git_read)
end
send_request
end
end end
end end
end end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe OnboardingProgressService do
describe '#execute' do
let_it_be(:namespace) { build(:namespace) }
let(:action) { :namespace_action }
subject(:execute_service) { described_class.new(namespace).execute(action: action) }
it 'records a namespace onboarding progress action' do
expect(NamespaceOnboardingAction).to receive(:create_action)
.with(namespace, :namespace_action)
subject
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