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
9e1db139
Commit
9e1db139
authored
Nov 03, 2015
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move level_name resolving to Gitlan::VisibilityLevel
parent
d2846293
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
app/services/base_service.rb
app/services/base_service.rb
+1
-4
lib/gitlab/visibility_level.rb
lib/gitlab/visibility_level.rb
+9
-0
No files found.
app/services/base_service.rb
View file @
9e1db139
...
...
@@ -39,10 +39,7 @@ class BaseService
def
deny_visibility_level
(
model
,
denied_visibility_level
=
nil
)
denied_visibility_level
||=
model
.
visibility_level
level_name
=
'Unknown'
Gitlab
::
VisibilityLevel
.
options
.
each
do
|
name
,
level
|
level_name
=
name
if
level
==
denied_visibility_level
end
level_name
=
Gitlab
::
VisibilityLevel
.
level_name
(
denied_visibility_level
)
model
.
errors
.
add
(
:visibility_level
,
...
...
lib/gitlab/visibility_level.rb
View file @
9e1db139
...
...
@@ -51,6 +51,15 @@ module Gitlab
def
allowed_fork_levels
(
origin_level
)
[
PRIVATE
,
INTERNAL
,
PUBLIC
].
select
{
|
level
|
level
<=
origin_level
}
end
def
level_name
(
level
)
level_name
=
'Unknown'
options
.
each
do
|
name
,
lvl
|
level_name
=
name
if
lvl
==
level
end
level_name
end
end
def
private?
...
...
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