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
946ea280
Commit
946ea280
authored
Dec 01, 2020
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add git write namespace onboarding action
For tracking onboarding progress
parent
b53c6d07
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
3 deletions
+31
-3
app/models/namespace_onboarding_action.rb
app/models/namespace_onboarding_action.rb
+5
-2
app/services/post_receive_service.rb
app/services/post_receive_service.rb
+6
-0
spec/models/namespace_onboarding_action_spec.rb
spec/models/namespace_onboarding_action_spec.rb
+7
-1
spec/services/post_receive_service_spec.rb
spec/services/post_receive_service_spec.rb
+13
-0
No files found.
app/models/namespace_onboarding_action.rb
View file @
946ea280
# frozen_string_literal: true
class
NamespaceOnboardingAction
<
ApplicationRecord
belongs_to
:namespace
belongs_to
:namespace
,
optional:
false
validates
:action
,
presence:
true
ACTIONS
=
{
subscription_created:
1
subscription_created:
1
,
git_write:
2
}.
freeze
enum
action:
ACTIONS
...
...
app/services/post_receive_service.rb
View file @
946ea280
...
...
@@ -40,6 +40,8 @@ class PostReceiveService
response
.
add_basic_message
(
redirect_message
)
response
.
add_basic_message
(
project_created_message
)
record_onboarding_progress
end
response
...
...
@@ -90,6 +92,10 @@ class PostReceiveService
banner
&
.
message
end
def
record_onboarding_progress
NamespaceOnboardingAction
.
create_action
(
project
.
namespace
,
:git_write
)
end
end
PostReceiveService
.
prepend_if_ee
(
'EE::PostReceiveService'
)
spec/models/namespace_onboarding_action_spec.rb
View file @
946ea280
...
...
@@ -5,7 +5,13 @@ require 'spec_helper'
RSpec
.
describe
NamespaceOnboardingAction
do
let
(
:namespace
)
{
build
(
:namespace
)
}
it
{
is_expected
.
to
belong_to
:namespace
}
describe
'associations'
do
it
{
is_expected
.
to
belong_to
(
:namespace
).
required
}
end
describe
'validations'
do
it
{
is_expected
.
to
validate_presence_of
(
:action
)
}
end
describe
'.completed?'
do
let
(
:action
)
{
:subscription_created
}
...
...
spec/services/post_receive_service_spec.rb
View file @
946ea280
...
...
@@ -45,6 +45,12 @@ RSpec.describe PostReceiveService do
it
'does not return error'
do
expect
(
subject
).
to
be_empty
end
it
'does not record a namespace onboarding progress action'
do
expect
(
NamespaceOnboardingAction
).
not_to
receive
(
:create_action
)
subject
end
end
context
'when repository is nil'
do
...
...
@@ -80,6 +86,13 @@ RSpec.describe PostReceiveService do
expect
(
response
.
reference_counter_decreased
).
to
be
(
true
)
end
it
'records a namespace onboarding progress action'
do
expect
(
NamespaceOnboardingAction
).
to
receive
(
:create_action
)
.
with
(
project
.
namespace
,
:git_write
)
subject
end
end
context
'with Project'
do
...
...
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