Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
96773f26
Commit
96773f26
authored
Dec 03, 2020
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add git read namespace onboarding action
For tracking onboarding progress
parent
d798edaf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
1 deletion
+42
-1
app/controllers/repositories/git_http_controller.rb
app/controllers/repositories/git_http_controller.rb
+2
-0
app/models/namespace_onboarding_action.rb
app/models/namespace_onboarding_action.rb
+2
-1
app/services/onboarding_progress_service.rb
app/services/onboarding_progress_service.rb
+11
-0
spec/controllers/repositories/git_http_controller_spec.rb
spec/controllers/repositories/git_http_controller_spec.rb
+8
-0
spec/services/onboarding_progress_service_spec.rb
spec/services/onboarding_progress_service_spec.rb
+19
-0
No files found.
app/controllers/repositories/git_http_controller.rb
View file @
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
...
...
app/models/namespace_onboarding_action.rb
View file @
96773f26
...
@@ -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
...
...
app/services/onboarding_progress_service.rb
0 → 100644
View file @
96773f26
# frozen_string_literal: true
class
OnboardingProgressService
def
initialize
(
namespace
)
@namespace
=
namespace
end
def
execute
(
action
:)
NamespaceOnboardingAction
.
create_action
(
@namespace
,
action
)
end
end
spec/controllers/repositories/git_http_controller_spec.rb
View file @
96773f26
...
@@ -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
...
...
spec/services/onboarding_progress_service_spec.rb
0 → 100644
View file @
96773f26
# 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment