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
68de5dcb
Commit
68de5dcb
authored
Aug 30, 2017
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error reported by Flay
parent
8ffbab21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
app/helpers/visibility_level_helper.rb
app/helpers/visibility_level_helper.rb
+16
-8
No files found.
app/helpers/visibility_level_helper.rb
View file @
68de5dcb
...
@@ -89,11 +89,10 @@ module VisibilityLevelHelper
...
@@ -89,11 +89,10 @@ module VisibilityLevelHelper
end
end
unless
project
.
visibility_level_allowed_by_group?
(
level
)
unless
project
.
visibility_level_allowed_by_group?
(
level
)
group
=
link_to
project
.
group
.
name
,
group_path
(
project
.
group
)
errors
=
visibility_level_errors_for_group
(
project
.
group
,
level_name
)
change_visiblity
=
link_to
'change the visibility'
,
edit_group_path
(
project
.
group
)
reasons
<<
"the visibility of
#{
group
}
is
#{
project
.
group
.
visibility
}
"
reasons
<<
errors
[
:reason
]
instructions
<<
" To make this project
#{
level_name
}
, you must first
#{
change_visiblity
}
of the parent group."
instructions
<<
errors
[
:instruction
]
end
end
reasons
=
reasons
.
any?
?
' because '
+
reasons
.
to_sentence
:
''
reasons
=
reasons
.
any?
?
' because '
+
reasons
.
to_sentence
:
''
...
@@ -116,11 +115,10 @@ module VisibilityLevelHelper
...
@@ -116,11 +115,10 @@ module VisibilityLevelHelper
end
end
unless
group
.
visibility_level_allowed_by_parent?
(
level
)
unless
group
.
visibility_level_allowed_by_parent?
(
level
)
parent_group
=
link_to
group
.
parent
.
name
,
group_path
(
group
.
parent
)
errors
=
visibility_level_errors_for_group
(
group
.
parent
,
level_name
)
change_visiblity
=
link_to
'change the visibility'
,
edit_group_path
(
group
.
parent
)
reasons
<<
"the visibility of
#{
parent_group
}
is
#{
group
.
parent
.
visibility
}
"
reasons
<<
errors
[
:reason
]
instructions
<<
" To make this group
#{
level_name
}
, you must first
#{
change_visiblity
}
of the parent group."
instructions
<<
errors
[
:instruction
]
end
end
reasons
=
reasons
.
any?
?
' because '
+
reasons
.
to_sentence
:
''
reasons
=
reasons
.
any?
?
' because '
+
reasons
.
to_sentence
:
''
...
@@ -163,4 +161,14 @@ module VisibilityLevelHelper
...
@@ -163,4 +161,14 @@ module VisibilityLevelHelper
return
false
unless
form_model
.
respond_to?
(
:visibility_level_allowed?
)
return
false
unless
form_model
.
respond_to?
(
:visibility_level_allowed?
)
!
form_model
.
visibility_level_allowed?
(
level
)
!
form_model
.
visibility_level_allowed?
(
level
)
end
end
private
def
visibility_level_errors_for_group
(
group
,
level_name
)
group
=
link_to
group
.
name
,
group_path
(
group
)
change_visiblity
=
link_to
'change the visibility'
,
edit_group_path
(
group
)
{
reason:
"the visibility of
#{
group
}
is
#{
group
.
visibility
}
"
,
instruction:
" To make this group
#{
level_name
}
, you must first
#{
change_visiblity
}
of the parent group."
}
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