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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
f87e2d28
Commit
f87e2d28
authored
Sep 09, 2013
by
Angus MacArthur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make public/private setting for project creation configurable
parent
9ad5d9a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
1 deletion
+32
-1
app/contexts/projects/create_context.rb
app/contexts/projects/create_context.rb
+2
-1
config/gitlab.yml.example
config/gitlab.yml.example
+1
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-0
spec/contexts/projects_create_context_spec.rb
spec/contexts/projects_create_context_spec.rb
+28
-0
No files found.
app/contexts/projects/create_context.rb
View file @
f87e2d28
...
@@ -16,7 +16,8 @@ module Projects
...
@@ -16,7 +16,8 @@ module Projects
wiki_enabled:
default_features
.
wiki
,
wiki_enabled:
default_features
.
wiki
,
wall_enabled:
default_features
.
wall
,
wall_enabled:
default_features
.
wall
,
snippets_enabled:
default_features
.
snippets
,
snippets_enabled:
default_features
.
snippets
,
merge_requests_enabled:
default_features
.
merge_requests
merge_requests_enabled:
default_features
.
merge_requests
,
public:
default_features
.
public
}
}
@project
=
Project
.
new
(
default_opts
.
merge
(
params
))
@project
=
Project
.
new
(
default_opts
.
merge
(
params
))
...
...
config/gitlab.yml.example
View file @
f87e2d28
...
@@ -58,6 +58,7 @@ production: &base
...
@@ -58,6 +58,7 @@ production: &base
wiki: true
wiki: true
wall: false
wall: false
snippets: false
snippets: false
public: false
## External issues trackers
## External issues trackers
issues_tracker:
issues_tracker:
...
...
config/initializers/1_settings.rb
View file @
f87e2d28
...
@@ -75,6 +75,7 @@ Settings.gitlab.default_projects_features['merge_requests'] = true if Settings.g
...
@@ -75,6 +75,7 @@ Settings.gitlab.default_projects_features['merge_requests'] = true if Settings.g
Settings
.
gitlab
.
default_projects_features
[
'wiki'
]
=
true
if
Settings
.
gitlab
.
default_projects_features
[
'wiki'
].
nil?
Settings
.
gitlab
.
default_projects_features
[
'wiki'
]
=
true
if
Settings
.
gitlab
.
default_projects_features
[
'wiki'
].
nil?
Settings
.
gitlab
.
default_projects_features
[
'wall'
]
=
false
if
Settings
.
gitlab
.
default_projects_features
[
'wall'
].
nil?
Settings
.
gitlab
.
default_projects_features
[
'wall'
]
=
false
if
Settings
.
gitlab
.
default_projects_features
[
'wall'
].
nil?
Settings
.
gitlab
.
default_projects_features
[
'snippets'
]
=
false
if
Settings
.
gitlab
.
default_projects_features
[
'snippets'
].
nil?
Settings
.
gitlab
.
default_projects_features
[
'snippets'
]
=
false
if
Settings
.
gitlab
.
default_projects_features
[
'snippets'
].
nil?
Settings
.
gitlab
.
default_projects_features
[
'public'
]
=
false
if
Settings
.
gitlab
.
default_projects_features
[
'public'
].
nil?
#
#
# Gravatar
# Gravatar
...
...
spec/contexts/projects_create_context_spec.rb
View file @
f87e2d28
...
@@ -30,6 +30,34 @@ describe Projects::CreateContext do
...
@@ -30,6 +30,34 @@ describe Projects::CreateContext do
it
{
@project
.
owner
.
should
==
@user
}
it
{
@project
.
owner
.
should
==
@user
}
it
{
@project
.
namespace
.
should
==
@group
}
it
{
@project
.
namespace
.
should
==
@group
}
end
end
context
'respect configured public setting'
do
before
(
:each
)
do
@settings
=
double
(
"settings"
)
@settings
.
stub
(
:issues
)
{
true
}
@settings
.
stub
(
:merge_requests
)
{
true
}
@settings
.
stub
(
:wiki
)
{
true
}
@settings
.
stub
(
:wall
)
{
true
}
@settings
.
stub
(
:snippets
)
{
true
}
stub_const
(
"Settings"
,
Class
.
new
)
Settings
.
stub_chain
(
:gitlab
,
:default_projects_features
).
and_return
(
@settings
)
end
context
'should be public when setting is public'
do
before
do
@settings
.
stub
(
:public
)
{
true
}
@project
=
create_project
(
@user
,
@opts
)
end
it
{
@project
.
public
.
should
be_true
}
end
context
'should be private when setting is not public'
do
before
do
@settings
.
stub
(
:public
)
{
false
}
@project
=
create_project
(
@user
,
@opts
)
end
it
{
@project
.
public
.
should
be_false
}
end
end
end
end
def
create_project
(
user
,
opts
)
def
create_project
(
user
,
opts
)
...
...
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