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
cc30d5d0
Commit
cc30d5d0
authored
Jun 08, 2020
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set a cookie when creating Learn Gitlab project
parent
4c1dff36
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
ee/app/controllers/registrations/projects_controller.rb
ee/app/controllers/registrations/projects_controller.rb
+9
-2
ee/spec/controllers/registrations/projects_controller_spec.rb
...pec/controllers/registrations/projects_controller_spec.rb
+2
-1
No files found.
ee/app/controllers/registrations/projects_controller.rb
View file @
cc30d5d0
...
...
@@ -25,9 +25,16 @@ module Registrations
private
def
create_learn_gitlab_project
File
.
open
(
learn_gitlab_template_path
)
do
|
archive
|
::
Projects
::
GitlabProjectsImportService
.
new
(
current_user
,
namespace_id:
@project
.
namespace_id
,
file:
archive
,
name:
s_
(
'Learn GitLab'
)).
execute
learn_gitlab_project
=
File
.
open
(
learn_gitlab_template_path
)
do
|
archive
|
::
Projects
::
GitlabProjectsImportService
.
new
(
current_user
,
namespace_id:
@project
.
namespace_id
,
file:
archive
,
name:
s_
(
'Learn GitLab'
)
).
execute
end
cookies
[
:onboarding_issues_settings
]
=
{
'groups#show'
=>
true
,
'projects#show'
=>
true
,
'issues#index'
=>
true
}.
to_json
if
learn_gitlab_project
.
saved?
end
def
learn_gitlab_template_path
...
...
ee/spec/controllers/registrations/projects_controller_spec.rb
View file @
cc30d5d0
...
...
@@ -64,7 +64,7 @@ RSpec.describe Registrations::ProjectsController do
stub_experiment_for_user
(
onboarding_issues:
true
)
end
it
'creates a new project, a "Learn GitLab" project and redirects to the experience level page'
do
it
'creates a new project, a "Learn GitLab" project
, sets a cookie
and redirects to the experience level page'
do
expect
{
subject
}.
to
change
{
namespace
.
projects
.
pluck
(
:name
)
}.
from
([]).
to
([
'New project'
,
s_
(
'Learn GitLab'
)])
Sidekiq
::
Worker
.
drain_all
...
...
@@ -72,6 +72,7 @@ RSpec.describe Registrations::ProjectsController do
expect
(
subject
).
to
have_gitlab_http_status
(
:redirect
)
expect
(
subject
).
to
redirect_to
(
users_sign_up_experience_level_path
)
expect
(
namespace
.
projects
.
find_by_name
(
s_
(
'Learn GitLab'
))).
to
be_import_finished
expect
(
cookies
[
:onboarding_issues_settings
]).
not_to
be_nil
end
context
'when the project cannot be saved'
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