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
852f5097
Commit
852f5097
authored
Aug 24, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename skip_level? to disallowed_visibitility_level?
parent
37edce19
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
15 deletions
+15
-15
app/helpers/visibility_level_helper.rb
app/helpers/visibility_level_helper.rb
+1
-1
app/views/shared/_visibility_radios.html.haml
app/views/shared/_visibility_radios.html.haml
+1
-1
spec/helpers/visibility_level_helper_spec.rb
spec/helpers/visibility_level_helper_spec.rb
+13
-13
No files found.
app/helpers/visibility_level_helper.rb
View file @
852f5097
...
...
@@ -95,7 +95,7 @@ module VisibilityLevelHelper
:default_group_visibility
,
to: :current_application_settings
def
skip
_level?
(
form_model
,
level
)
def
disallowed_visibility
_level?
(
form_model
,
level
)
return
false
unless
form_model
.
respond_to?
(
:visibility_level_allowed?
)
!
form_model
.
visibility_level_allowed?
(
level
)
end
...
...
app/views/shared/_visibility_radios.html.haml
View file @
852f5097
-
Gitlab
::
VisibilityLevel
.
values
.
each
do
|
level
|
-
next
if
skip
_level?
(
form_model
,
level
)
-
next
if
disallowed_visibility
_level?
(
form_model
,
level
)
.radio
-
restricted
=
restricted_visibility_levels
.
include?
(
level
)
=
form
.
label
"
#{
model_method
}
_
#{
level
}
"
do
...
...
spec/helpers/visibility_level_helper_spec.rb
View file @
852f5097
...
...
@@ -58,35 +58,35 @@ describe VisibilityLevelHelper do
end
end
describe
"
skip
_level?"
do
describe
"
disallowed_visibility
_level?"
do
describe
"forks"
do
let
(
:project
)
{
create
(
:project
,
:internal
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
it
"
skip
s levels"
do
expect
(
skip
_level?
(
fork_project
,
Gitlab
::
VisibilityLevel
::
PUBLIC
)).
to
be_truthy
expect
(
skip
_level?
(
fork_project
,
Gitlab
::
VisibilityLevel
::
INTERNAL
)).
to
be_falsey
expect
(
skip
_level?
(
fork_project
,
Gitlab
::
VisibilityLevel
::
PRIVATE
)).
to
be_falsey
it
"
disallow
s levels"
do
expect
(
disallowed_visibility
_level?
(
fork_project
,
Gitlab
::
VisibilityLevel
::
PUBLIC
)).
to
be_truthy
expect
(
disallowed_visibility
_level?
(
fork_project
,
Gitlab
::
VisibilityLevel
::
INTERNAL
)).
to
be_falsey
expect
(
disallowed_visibility
_level?
(
fork_project
,
Gitlab
::
VisibilityLevel
::
PRIVATE
)).
to
be_falsey
end
end
describe
"non-forked project"
do
let
(
:project
)
{
create
(
:project
,
:internal
)
}
it
"
skip
s levels"
do
expect
(
skip
_level?
(
project
,
Gitlab
::
VisibilityLevel
::
PUBLIC
)).
to
be_falsey
expect
(
skip
_level?
(
project
,
Gitlab
::
VisibilityLevel
::
INTERNAL
)).
to
be_falsey
expect
(
skip
_level?
(
project
,
Gitlab
::
VisibilityLevel
::
PRIVATE
)).
to
be_falsey
it
"
disallow
s levels"
do
expect
(
disallowed_visibility
_level?
(
project
,
Gitlab
::
VisibilityLevel
::
PUBLIC
)).
to
be_falsey
expect
(
disallowed_visibility
_level?
(
project
,
Gitlab
::
VisibilityLevel
::
INTERNAL
)).
to
be_falsey
expect
(
disallowed_visibility
_level?
(
project
,
Gitlab
::
VisibilityLevel
::
PRIVATE
)).
to
be_falsey
end
end
describe
"Snippet"
do
let
(
:snippet
)
{
create
(
:snippet
,
:internal
)
}
it
"
skip
s levels"
do
expect
(
skip
_level?
(
snippet
,
Gitlab
::
VisibilityLevel
::
PUBLIC
)).
to
be_falsey
expect
(
skip
_level?
(
snippet
,
Gitlab
::
VisibilityLevel
::
INTERNAL
)).
to
be_falsey
expect
(
skip
_level?
(
snippet
,
Gitlab
::
VisibilityLevel
::
PRIVATE
)).
to
be_falsey
it
"
disallow
s levels"
do
expect
(
disallowed_visibility
_level?
(
snippet
,
Gitlab
::
VisibilityLevel
::
PUBLIC
)).
to
be_falsey
expect
(
disallowed_visibility
_level?
(
snippet
,
Gitlab
::
VisibilityLevel
::
INTERNAL
)).
to
be_falsey
expect
(
disallowed_visibility
_level?
(
snippet
,
Gitlab
::
VisibilityLevel
::
PRIVATE
)).
to
be_falsey
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