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
4967c087
Commit
4967c087
authored
Jun 30, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix signup and project visibility
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
13f017f0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
4 additions
and
105 deletions
+4
-105
app/controllers/registrations_controller.rb
app/controllers/registrations_controller.rb
+0
-1
app/models/project.rb
app/models/project.rb
+3
-0
lib/api/users.rb
lib/api/users.rb
+1
-1
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+0
-13
spec/services/notes/create_service_spec.rb
spec/services/notes/create_service_spec.rb
+0
-1
spec/services/projects/create_service_spec.rb
spec/services/projects/create_service_spec.rb
+0
-89
No files found.
app/controllers/registrations_controller.rb
View file @
4967c087
...
...
@@ -13,7 +13,6 @@ class RegistrationsController < Devise::RegistrationsController
def
build_resource
(
hash
=
nil
)
super
self
.
resource
.
with_defaults
end
private
...
...
app/models/project.rb
View file @
4967c087
...
...
@@ -97,6 +97,9 @@ class Project < ActiveRecord::Base
message:
"only letters, digits & '_' '-' '.' allowed. Letter or digit should be first"
}
validates
:issues_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
inclusion:
{
in:
[
true
,
false
]
}
validates
:visibility_level
,
exclusion:
{
in:
gitlab_config
.
restricted_visibility_levels
},
if:
->
{
gitlab_config
.
restricted_visibility_levels
.
any?
}
validates
:issues_tracker_id
,
length:
{
maximum:
255
},
allow_blank:
true
validates
:namespace
,
presence:
true
validates_uniqueness_of
:name
,
scope: :namespace_id
...
...
lib/api/users.rb
View file @
4967c087
...
...
@@ -96,7 +96,7 @@ module API
admin
=
attrs
.
delete
(
:admin
)
user
.
admin
=
admin
unless
admin
.
nil?
if
user
.
update_attributes
(
attrs
,
as: :admin
)
if
user
.
update_attributes
(
attrs
)
present
user
,
with:
Entities
::
UserFull
else
not_found!
...
...
spec/requests/api/users_spec.rb
View file @
4967c087
...
...
@@ -97,19 +97,6 @@ describe API::API, api: true do
response
.
status
.
should
==
201
end
it
"creating a user should respect default project limit"
do
limit
=
123456
Gitlab
.
config
.
gitlab
.
stub
(
:default_projects_limit
).
and_return
(
limit
)
attr
=
attributes_for
(
:user
)
expect
{
post
api
(
"/users"
,
admin
),
attr
}.
to
change
{
User
.
count
}.
by
(
1
)
user
=
User
.
find_by
(
username:
attr
[
:username
])
user
.
projects_limit
.
should
==
limit
user
.
theme_id
.
should
==
Gitlab
::
Theme
::
MARS
Gitlab
.
config
.
gitlab
.
unstub
(
:default_projects_limit
)
end
it
"should not create user with invalid email"
do
post
api
(
"/users"
,
admin
),
{
email:
"invalid email"
,
password:
'password'
}
response
.
status
.
should
==
400
...
...
spec/services/notes/create_service_spec.rb
View file @
4967c087
...
...
@@ -11,7 +11,6 @@ describe Notes::CreateService do
project
.
team
<<
[
user
,
:master
]
opts
=
{
note:
'Awesome comment'
,
description:
'please fix'
,
noteable_type:
'Issue'
,
noteable_id:
issue
.
id
}
...
...
spec/services/projects/create_service_spec.rb
View file @
4967c087
...
...
@@ -55,95 +55,6 @@ describe Projects::CreateService do
it
{
File
.
exists?
(
@path
).
should
be_false
}
end
end
context
'respect configured visibility setting'
do
before
(
:each
)
do
@settings
=
double
(
"settings"
)
@settings
.
stub
(
:issues
)
{
true
}
@settings
.
stub
(
:merge_requests
)
{
true
}
@settings
.
stub
(
:wiki
)
{
true
}
@settings
.
stub
(
:snippets
)
{
true
}
Gitlab
.
config
.
gitlab
.
stub
(
restricted_visibility_levels:
[])
Gitlab
.
config
.
gitlab
.
stub
(
:default_projects_features
).
and_return
(
@settings
)
end
context
'should be public when setting is public'
do
before
do
@settings
.
stub
(
:visibility_level
)
{
Gitlab
::
VisibilityLevel
::
PUBLIC
}
@project
=
create_project
(
@user
,
@opts
)
end
it
{
@project
.
public?
.
should
be_true
}
end
context
'should be private when setting is private'
do
before
do
@settings
.
stub
(
:visibility_level
)
{
Gitlab
::
VisibilityLevel
::
PRIVATE
}
@project
=
create_project
(
@user
,
@opts
)
end
it
{
@project
.
private?
.
should
be_true
}
end
context
'should be internal when setting is internal'
do
before
do
@settings
.
stub
(
:visibility_level
)
{
Gitlab
::
VisibilityLevel
::
INTERNAL
}
@project
=
create_project
(
@user
,
@opts
)
end
it
{
@project
.
internal?
.
should
be_true
}
end
end
context
'respect configured visibility restrictions setting'
do
before
(
:each
)
do
@settings
=
double
(
"settings"
)
@settings
.
stub
(
:issues
)
{
true
}
@settings
.
stub
(
:merge_requests
)
{
true
}
@settings
.
stub
(
:wiki
)
{
true
}
@settings
.
stub
(
:snippets
)
{
true
}
@settings
.
stub
(
:visibility_level
)
{
Gitlab
::
VisibilityLevel
::
PRIVATE
}
@restrictions
=
[
Gitlab
::
VisibilityLevel
::
PUBLIC
]
Gitlab
.
config
.
gitlab
.
stub
(
restricted_visibility_levels:
@restrictions
)
Gitlab
.
config
.
gitlab
.
stub
(
:default_projects_features
).
and_return
(
@settings
)
end
context
'should be private when option is public'
do
before
do
@opts
.
merge!
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
@project
=
create_project
(
@user
,
@opts
)
end
it
{
@project
.
private?
.
should
be_true
}
end
context
'should be public when option is public for admin'
do
before
do
@opts
.
merge!
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
@project
=
create_project
(
@admin
,
@opts
)
end
it
{
@project
.
public?
.
should
be_true
}
end
context
'should be private when option is private'
do
before
do
@opts
.
merge!
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
)
@project
=
create_project
(
@user
,
@opts
)
end
it
{
@project
.
private?
.
should
be_true
}
end
context
'should be internal when option is internal'
do
before
do
@opts
.
merge!
(
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
@project
=
create_project
(
@user
,
@opts
)
end
it
{
@project
.
internal?
.
should
be_true
}
end
end
end
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