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
f5ec6b4e
Commit
f5ec6b4e
authored
Jul 23, 2019
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove project from show_label_issuables_link?
The project param is unnecessary here
parent
17fe0307
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
26 deletions
+7
-26
app/helpers/labels_helper.rb
app/helpers/labels_helper.rb
+2
-3
app/views/shared/_label_row.html.haml
app/views/shared/_label_row.html.haml
+2
-2
spec/helpers/labels_helper_spec.rb
spec/helpers/labels_helper_spec.rb
+3
-21
No files found.
app/helpers/labels_helper.rb
View file @
f5ec6b4e
...
...
@@ -4,11 +4,10 @@ module LabelsHelper
extend
self
include
ActionView
::
Helpers
::
TagHelper
def
show_label_issuables_link?
(
label
,
issuables_type
,
current_user:
nil
,
project:
nil
)
def
show_label_issuables_link?
(
label
,
issuables_type
,
current_user:
nil
)
return
true
unless
label
.
project_label?
return
true
unless
project
project
.
feature_available?
(
issuables_type
,
current_user
)
label
.
project
.
feature_available?
(
issuables_type
,
current_user
)
end
# Link to a Label
...
...
app/views/shared/_label_row.html.haml
View file @
f5ec6b4e
-
force_priority
=
local_assigns
.
fetch
(
:force_priority
,
false
)
-
subject_or_group_defined
=
defined?
(
@project
)
||
defined?
(
@group
)
-
show_label_issues_link
=
subject_or_group_defined
&&
show_label_issuables_link?
(
label
,
:issues
,
project:
@project
)
-
show_label_merge_requests_link
=
subject_or_group_defined
&&
show_label_issuables_link?
(
label
,
:merge_requests
,
project:
@project
)
-
show_label_issues_link
=
subject_or_group_defined
&&
show_label_issuables_link?
(
label
,
:issues
)
-
show_label_merge_requests_link
=
subject_or_group_defined
&&
show_label_issuables_link?
(
label
,
:merge_requests
)
.label-name
=
render_label
(
label
,
tooltip:
false
)
...
...
spec/helpers/labels_helper_spec.rb
View file @
f5ec6b4e
...
...
@@ -3,10 +3,8 @@ require 'spec_helper'
describe
LabelsHelper
do
describe
'#show_label_issuables_link?'
do
shared_examples
'a valid response to show_label_issuables_link?'
do
|
issuables_type
,
when_enabled
=
true
,
when_disabled
=
false
|
let
(
:context_project
)
{
project
}
context
"when asking for a
#{
issuables_type
}
link"
do
subject
{
show_label_issuables_link?
(
label
.
present
(
issuable_subject:
nil
),
issuables_type
,
project:
context_project
)
}
subject
{
show_label_issuables_link?
(
label
.
present
(
issuable_subject:
nil
),
issuables_type
)
}
context
"when
#{
issuables_type
}
are enabled for the project"
do
let
(
:project
)
{
create
(
:project
,
"
#{
issuables_type
}
_access_level"
:
ProjectFeature
::
ENABLED
)
}
...
...
@@ -39,27 +37,11 @@ describe LabelsHelper do
let
(
:label
)
{
create
(
:group_label
,
group:
group
,
title:
'bug'
)
}
context
'when asking for an issue link'
do
context
'in the context of a project'
do
it_behaves_like
'a valid response to show_label_issuables_link?'
,
:issues
,
true
,
true
end
context
'in the context of a group'
do
let
(
:context_project
)
{
nil
}
it_behaves_like
'a valid response to show_label_issuables_link?'
,
:issues
,
true
,
true
end
it_behaves_like
'a valid response to show_label_issuables_link?'
,
:issues
,
true
,
true
end
context
'when asking for a merge requests link'
do
context
'in the context of a project'
do
it_behaves_like
'a valid response to show_label_issuables_link?'
,
:merge_requests
,
true
,
true
end
context
'in the context of a group'
do
let
(
:context_project
)
{
nil
}
it_behaves_like
'a valid response to show_label_issuables_link?'
,
:merge_requests
,
true
,
true
end
it_behaves_like
'a valid response to show_label_issuables_link?'
,
:merge_requests
,
true
,
true
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