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
a63ad4e4
Commit
a63ad4e4
authored
Mar 04, 2021
by
Manoj M J
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix translation of visibility levels
Fix translation of visibility levels
parent
dc6f5e98
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
13 deletions
+47
-13
app/helpers/visibility_level_helper.rb
app/helpers/visibility_level_helper.rb
+1
-3
lib/gitlab/visibility_level.rb
lib/gitlab/visibility_level.rb
+4
-9
spec/features/projects/new_project_spec.rb
spec/features/projects/new_project_spec.rb
+1
-1
spec/helpers/visibility_level_helper_spec.rb
spec/helpers/visibility_level_helper_spec.rb
+16
-0
spec/lib/gitlab/visibility_level_spec.rb
spec/lib/gitlab/visibility_level_spec.rb
+25
-0
No files found.
app/helpers/visibility_level_helper.rb
View file @
a63ad4e4
...
...
@@ -35,9 +35,7 @@ module VisibilityLevelHelper
end
def
visibility_level_label
(
level
)
# The visibility level can be:
# 'VisibilityLevel|Private', 'VisibilityLevel|Internal', 'VisibilityLevel|Public'
s_
(
Project
.
visibility_levels
.
key
(
level
))
Project
.
visibility_levels
.
key
(
level
)
end
def
restricted_visibility_levels
(
show_all
=
false
)
...
...
lib/gitlab/visibility_level.rb
View file @
a63ad4e4
...
...
@@ -44,9 +44,9 @@ module Gitlab
def
options
{
N
_
(
'VisibilityLevel|Private'
)
=>
PRIVATE
,
N
_
(
'VisibilityLevel|Internal'
)
=>
INTERNAL
,
N
_
(
'VisibilityLevel|Public'
)
=>
PUBLIC
s
_
(
'VisibilityLevel|Private'
)
=>
PRIVATE
,
s
_
(
'VisibilityLevel|Internal'
)
=>
INTERNAL
,
s
_
(
'VisibilityLevel|Public'
)
=>
PUBLIC
}
end
...
...
@@ -104,12 +104,7 @@ module Gitlab
end
def
level_name
(
level
)
level_name
=
N_
(
'VisibilityLevel|Unknown'
)
options
.
each
do
|
name
,
lvl
|
level_name
=
name
if
lvl
==
level
.
to_i
end
s_
(
level_name
)
options
.
key
(
level
.
to_i
)
||
s_
(
'VisibilityLevel|Unknown'
)
end
def
level_value
(
level
)
...
...
spec/features/projects/new_project_spec.rb
View file @
a63ad4e4
...
...
@@ -86,7 +86,7 @@ RSpec.describe 'New project', :js do
visit
new_project_path
find
(
'[data-qa-selector="blank_project_link"]'
).
click
choose
(
s_
(
key
)
)
choose
(
key
)
click_button
(
'Create project'
)
page
.
within
(
'#blank-project-pane'
)
do
expect
(
find_field
(
"project_visibility_level_
#{
level
}
"
)).
to
be_checked
...
...
spec/helpers/visibility_level_helper_spec.rb
View file @
a63ad4e4
...
...
@@ -33,6 +33,22 @@ RSpec.describe VisibilityLevelHelper do
end
end
describe
'visibility_level_label'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:level_value
,
:level_name
)
do
Gitlab
::
VisibilityLevel
::
PRIVATE
|
'Private'
Gitlab
::
VisibilityLevel
::
INTERNAL
|
'Internal'
Gitlab
::
VisibilityLevel
::
PUBLIC
|
'Public'
end
with_them
do
it
'returns the name of the visibility level'
do
expect
(
visibility_level_label
(
level_value
)).
to
eq
(
level_name
)
end
end
end
describe
'visibility_level_description'
do
context
'used with a Project'
do
let
(
:descriptions
)
do
...
...
spec/lib/gitlab/visibility_level_spec.rb
View file @
a63ad4e4
...
...
@@ -131,4 +131,29 @@ RSpec.describe Gitlab::VisibilityLevel do
end
end
end
describe
'.options'
do
context
'keys'
do
it
'returns the allowed visibility levels'
do
expect
(
described_class
.
options
.
keys
).
to
contain_exactly
(
'Private'
,
'Internal'
,
'Public'
)
end
end
end
describe
'.level_name'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:level_value
,
:level_name
)
do
described_class
::
PRIVATE
|
'Private'
described_class
::
INTERNAL
|
'Internal'
described_class
::
PUBLIC
|
'Public'
non_existing_record_access_level
|
'Unknown'
end
with_them
do
it
'returns the name of the visibility level'
do
expect
(
described_class
.
level_name
(
level_value
)).
to
eq
(
level_name
)
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