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
f897db6b
Commit
f897db6b
authored
Nov 06, 2020
by
Eulyeon Ko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generalize scoped_labels_available helper
Make the helper accept parent parameter.
parent
4ac99e12
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
9 deletions
+23
-9
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+1
-1
app/views/groups/issues.html.haml
app/views/groups/issues.html.haml
+1
-1
ee/app/helpers/ee/issues_helper.rb
ee/app/helpers/ee/issues_helper.rb
+3
-2
ee/spec/helpers/ee/issues_helper_spec.rb
ee/spec/helpers/ee/issues_helper_spec.rb
+18
-5
No files found.
app/helpers/issues_helper.rb
View file @
f897db6b
...
...
@@ -172,7 +172,7 @@ module IssuesHelper
end
# Overridden in EE
def
scoped_labels_available?
(
p
rojec
t
)
def
scoped_labels_available?
(
p
aren
t
)
false
end
end
...
...
app/views/groups/issues.html.haml
View file @
f897db6b
...
...
@@ -31,6 +31,6 @@
'empty-state-meta'
:
{
svg_path:
image_path
(
'illustrations/issues.svg'
)
},
'sort-key'
:
@sort
,
type:
'issues'
,
'scoped-labels'
:
@group
.
feature_available?
(
:scoped_labels
).
to_json
}
}
'scoped-labels'
:
scoped_labels_available?
(
@group
).
to_json
}
}
-
else
=
render
'shared/issues'
ee/app/helpers/ee/issues_helper.rb
View file @
f897db6b
...
...
@@ -55,8 +55,9 @@ module EE
issue
.
incident?
&&
issue
.
project
.
feature_available?
(
:incident_timeline_view
)
end
def
scoped_labels_available?
(
project
)
project
.
feature_available?
(
:scoped_labels
)
override
:scoped_labels_available?
def
scoped_labels_available?
(
parent
)
parent
.
feature_available?
(
:scoped_labels
)
end
end
end
ee/spec/helpers/ee/issues_helper_spec.rb
View file @
f897db6b
...
...
@@ -3,7 +3,8 @@
require
"spec_helper"
RSpec
.
describe
EE
::
IssuesHelper
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:group
)
{
create
:group
}
let
(
:project
)
{
create
:project
,
group:
group
}
let
(
:issue
)
{
create
:issue
,
project:
project
}
describe
'#issue_closed_link'
do
...
...
@@ -91,9 +92,7 @@ RSpec.describe EE::IssuesHelper do
end
describe
'#scoped_labels_available?'
do
subject
{
helper
.
scoped_labels_available?
(
project
)
}
context
'without license'
do
shared_examples
'without license'
do
before
do
stub_licensed_features
(
scoped_labels:
false
)
end
...
...
@@ -101,12 +100,26 @@ RSpec.describe EE::IssuesHelper do
it
{
is_expected
.
to
be_falsy
}
end
context
'with license'
do
shared_examples
'with license'
do
before
do
stub_licensed_features
(
scoped_labels:
true
)
end
it
{
is_expected
.
to
be_truthy
}
end
context
'project'
do
subject
{
helper
.
scoped_labels_available?
(
project
)
}
it_behaves_like
'without license'
it_behaves_like
'with license'
end
context
'group'
do
subject
{
helper
.
scoped_labels_available?
(
group
)
}
it_behaves_like
'without license'
it_behaves_like
'with license'
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