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
565b3a18
Commit
565b3a18
authored
Jul 17, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow a project import URL to be blank to prevent false positives
preventing settings from being saved
parent
1bf57b75
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/models/project.rb
app/models/project.rb
+2
-2
spec/models/project_spec.rb
spec/models/project_spec.rb
+2
-2
No files found.
app/models/project.rb
View file @
565b3a18
...
@@ -162,7 +162,7 @@ class Project < ActiveRecord::Base
...
@@ -162,7 +162,7 @@ class Project < ActiveRecord::Base
validates
:namespace
,
presence:
true
validates
:namespace
,
presence:
true
validates_uniqueness_of
:name
,
scope: :namespace_id
validates_uniqueness_of
:name
,
scope: :namespace_id
validates_uniqueness_of
:path
,
scope: :namespace_id
validates_uniqueness_of
:path
,
scope: :namespace_id
validates
:import_url
,
addressable_url:
true
,
if:
:import_url
validates
:import_url
,
addressable_url:
true
,
if:
"import_url.present?"
validates
:star_count
,
numericality:
{
greater_than_or_equal_to:
0
}
validates
:star_count
,
numericality:
{
greater_than_or_equal_to:
0
}
validate
:check_limit
,
on: :create
validate
:check_limit
,
on: :create
validate
:avatar_type
,
validate
:avatar_type
,
...
@@ -482,7 +482,7 @@ class Project < ActiveRecord::Base
...
@@ -482,7 +482,7 @@ class Project < ActiveRecord::Base
end
end
def
create_or_update_import_data
(
data:
nil
,
credentials:
nil
)
def
create_or_update_import_data
(
data:
nil
,
credentials:
nil
)
return
unless
valid_import_url?
return
unless
import_url
.
present?
&&
valid_import_url?
project_import_data
=
import_data
||
build_import_data
project_import_data
=
import_data
||
build_import_data
if
data
if
data
...
...
spec/models/project_spec.rb
View file @
565b3a18
...
@@ -142,10 +142,10 @@ describe Project, models: true do
...
@@ -142,10 +142,10 @@ describe Project, models: true do
expect
(
project2
).
to
be_valid
expect
(
project2
).
to
be_valid
end
end
it
'
does not allow to introduce
an empty URI'
do
it
'
allows
an empty URI'
do
project2
=
build
(
:project
,
import_url:
''
)
project2
=
build
(
:project
,
import_url:
''
)
expect
(
project2
).
not_
to
be_valid
expect
(
project2
).
to
be_valid
end
end
it
'does not produce import data on an empty URI'
do
it
'does not produce import data on an empty URI'
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