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
9c9dafc6
Commit
9c9dafc6
authored
Oct 10, 2019
by
Aleksei Lipniagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename into `drop_visibility_level!`
parent
5243de82
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
app/models/project.rb
app/models/project.rb
+1
-1
lib/gitlab/import_export/project_tree_restorer.rb
lib/gitlab/import_export/project_tree_restorer.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+5
-5
No files found.
app/models/project.rb
View file @
9c9dafc6
...
@@ -2258,7 +2258,7 @@ class Project < ApplicationRecord
...
@@ -2258,7 +2258,7 @@ class Project < ApplicationRecord
setting
setting
end
end
def
correct_visibility_level
def
drop_visibility_level!
if
group
&&
group
.
visibility_level
<
visibility_level
if
group
&&
group
.
visibility_level
<
visibility_level
self
.
visibility_level
=
group
.
visibility_level
self
.
visibility_level
=
group
.
visibility_level
end
end
...
...
lib/gitlab/import_export/project_tree_restorer.rb
View file @
9c9dafc6
...
@@ -143,7 +143,7 @@ module Gitlab
...
@@ -143,7 +143,7 @@ module Gitlab
excluded_keys:
excluded_keys_for_relation
(
:project
))
excluded_keys:
excluded_keys_for_relation
(
:project
))
@project
.
assign_attributes
(
project_params
)
@project
.
assign_attributes
(
project_params
)
@project
.
correct_visibility_level
@project
.
drop_visibility_level!
@project
.
save!
@project
.
save!
end
end
end
end
...
...
spec/models/project_spec.rb
View file @
9c9dafc6
...
@@ -5179,7 +5179,7 @@ describe Project do
...
@@ -5179,7 +5179,7 @@ describe Project do
end
end
end
end
describe
'#
correct_visibility_level
'
do
describe
'#
drop_visibility_level!
'
do
context
'when has a group'
do
context
'when has a group'
do
let
(
:group
)
{
create
(
:group
,
visibility_level:
group_visibility_level
)
}
let
(
:group
)
{
create
(
:group
,
visibility_level:
group_visibility_level
)
}
let
(
:project
)
{
build
(
:project
,
namespace:
group
,
visibility_level:
project_visibility_level
)
}
let
(
:project
)
{
build
(
:project
,
namespace:
group
,
visibility_level:
project_visibility_level
)
}
...
@@ -5189,7 +5189,7 @@ describe Project do
...
@@ -5189,7 +5189,7 @@ describe Project do
let
(
:project_visibility_level
)
{
Gitlab
::
VisibilityLevel
::
INTERNAL
}
let
(
:project_visibility_level
)
{
Gitlab
::
VisibilityLevel
::
INTERNAL
}
it
'sets `visibility_level` value from the group'
do
it
'sets `visibility_level` value from the group'
do
expect
{
project
.
correct_visibility_level
}
expect
{
project
.
drop_visibility_level!
}
.
to
change
{
project
.
visibility_level
}
.
to
change
{
project
.
visibility_level
}
.
to
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
.
to
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
end
end
...
@@ -5200,7 +5200,7 @@ describe Project do
...
@@ -5200,7 +5200,7 @@ describe Project do
let
(
:project_visibility_level
)
{
Gitlab
::
VisibilityLevel
::
PRIVATE
}
let
(
:project_visibility_level
)
{
Gitlab
::
VisibilityLevel
::
PRIVATE
}
it
'does not change the value of the `visibility_level` field'
do
it
'does not change the value of the `visibility_level` field'
do
expect
{
project
.
correct_visibility_level
}
expect
{
project
.
drop_visibility_level!
}
.
not_to
change
{
project
.
visibility_level
}
.
not_to
change
{
project
.
visibility_level
}
end
end
end
end
...
@@ -5217,7 +5217,7 @@ describe Project do
...
@@ -5217,7 +5217,7 @@ describe Project do
let
(
:project_visibility_level
)
{
Gitlab
::
VisibilityLevel
::
INTERNAL
}
let
(
:project_visibility_level
)
{
Gitlab
::
VisibilityLevel
::
INTERNAL
}
it
'sets `visibility_level` value to `PRIVATE`'
do
it
'sets `visibility_level` value to `PRIVATE`'
do
expect
{
project
.
correct_visibility_level
}
expect
{
project
.
drop_visibility_level!
}
.
to
change
{
project
.
visibility_level
}
.
to
change
{
project
.
visibility_level
}
.
to
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
.
to
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
end
end
...
@@ -5227,7 +5227,7 @@ describe Project do
...
@@ -5227,7 +5227,7 @@ describe Project do
let
(
:project_visibility_level
)
{
Gitlab
::
VisibilityLevel
::
PUBLIC
}
let
(
:project_visibility_level
)
{
Gitlab
::
VisibilityLevel
::
PUBLIC
}
it
'does not change the value of the `visibility_level` field'
do
it
'does not change the value of the `visibility_level` field'
do
expect
{
project
.
correct_visibility_level
}
expect
{
project
.
drop_visibility_level!
}
.
to
not_change
{
project
.
visibility_level
}
.
to
not_change
{
project
.
visibility_level
}
end
end
end
end
...
...
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