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
7e60a9e2
Commit
7e60a9e2
authored
Dec 19, 2018
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove epic field for projects not in groups
Also fixes epics field being shown in MRs
parent
1225a6ee
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
104 additions
and
26 deletions
+104
-26
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+2
-4
ee/app/helpers/license_helper.rb
ee/app/helpers/license_helper.rb
+0
-4
ee/app/models/concerns/ee/issuable.rb
ee/app/models/concerns/ee/issuable.rb
+12
-6
ee/app/views/shared/issuable/_sidebar_item_epic.haml
ee/app/views/shared/issuable/_sidebar_item_epic.haml
+4
-4
ee/app/views/shared/promotions/_promote_epics.html.haml
ee/app/views/shared/promotions/_promote_epics.html.haml
+1
-1
ee/changelogs/unreleased/7866-fix-epics-promotion-helper.yml
ee/changelogs/unreleased/7866-fix-epics-promotion-helper.yml
+5
-0
ee/spec/features/issues/epic_in_issue_sidebar_spec.rb
ee/spec/features/issues/epic_in_issue_sidebar_spec.rb
+46
-7
ee/spec/features/merge_request/sidebar_spec.rb
ee/spec/features/merge_request/sidebar_spec.rb
+34
-0
No files found.
app/models/concerns/issuable.rb
View file @
7e60a9e2
...
...
@@ -373,7 +373,5 @@ module Issuable
end
end
# We have to prepend into Issuable::ClassMethods, as otherwise the methods
# defined in EE::Issuable will available on Issuable, and not
# Issuable::ClassMethods (= what in turn is exposed to classes).
Issuable
::
ClassMethods
.
prepend
(
EE
::
Issuable
)
Issuable
.
prepend
(
EE
::
Issuable
)
# rubocop: disable Cop/InjectEnterpriseEditionModule
Issuable
::
ClassMethods
.
prepend
(
EE
::
Issuable
::
ClassMethods
)
ee/app/helpers/license_helper.rb
View file @
7e60a9e2
...
...
@@ -110,9 +110,5 @@ module LicenseHelper
!
Gitlab
::
CurrentSettings
.
should_check_namespace_plan?
&&
show_promotions?
&&
show_callout?
(
'promote_advanced_search_dismissed'
)
&&
!
License
.
feature_available?
(
:elastic_search
)
end
def
promote_feature?
(
feature_name
)
!
@project
&
.
group
&
.
feature_available?
(
feature_name
)
&&
show_promotions?
&&
show_callout?
(
feature_name
)
end
extend
self
end
ee/app/models/concerns/ee/issuable.rb
View file @
7e60a9e2
...
...
@@ -4,15 +4,21 @@ module EE
module
Issuable
extend
ActiveSupport
::
Concern
def
labels_hash
issue_labels
=
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
[]
}
class_methods
do
def
labels_hash
issue_labels
=
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
[]
}
relation
=
unscoped
.
where
(
id:
self
.
select
(
:id
)).
eager_load
(
:labels
)
relation
.
pluck
(
:id
,
'labels.title'
).
each
do
|
issue_id
,
label
|
issue_labels
[
issue_id
]
<<
label
relation
=
unscoped
.
where
(
id:
self
.
select
(
:id
)).
eager_load
(
:labels
)
relation
.
pluck
(
:id
,
'labels.title'
).
each
do
|
issue_id
,
label
|
issue_labels
[
issue_id
]
<<
label
end
issue_labels
end
end
issue_labels
def
supports_epic?
is_a?
(
Issue
)
&&
project
.
group
end
end
end
ee/app/views/shared/issuable/_sidebar_item_epic.haml
View file @
7e60a9e2
-
if
issuable
.
project
.
feature_available?
(
:epics
)
-
if
issuable
.
is_a?
(
Issue
)
-
if
issuable
.
supports_epic?
-
if
issuable
.
project
.
group
.
feature_available?
(
:epics
)
.block.epic
#js-vue-sidebar-item-epic
.title.hide-collapsed
Epic
=
icon
(
'spinner spin'
)
-
else
=
render
'shared/promotions/promote_epics'
-
else
=
render
'shared/promotions/promote_epics'
ee/app/views/shared/promotions/_promote_epics.html.haml
View file @
7e60a9e2
-
promotion_feature
=
'promote_epics_sidebar_dismissed'
-
if
promote_feature?
(
:epic
)
&&
show_promotions?
&&
show_callout?
(
promotion_feature
)
-
if
show_promotions?
&&
show_callout?
(
promotion_feature
)
.block.js-epics-sidebar-callout.promotion-issue-sidebar
{
data:
{
uid:
promotion_feature
}
}
.sidebar-collapsed-icon
{
data:
{
toggle:
"dropdown"
,
target:
".js-epics-sidebar-callout"
}
}
%span
{
data:
{
toggle:
"tooltip"
,
placement:
"left"
,
container:
"body"
},
title:
_
(
'Epic'
)
}
...
...
ee/changelogs/unreleased/7866-fix-epics-promotion-helper.yml
0 → 100644
View file @
7e60a9e2
---
title
:
Remove epic field in sidebar for projects without groups
merge_request
:
8919
author
:
type
:
fixed
ee/spec/features/issues/epic_in_issue_sidebar_spec.rb
View file @
7e60a9e2
...
...
@@ -8,27 +8,66 @@ describe 'Epic in issue sidebar', :js do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:epic_issue
)
{
create
(
:epic_issue
,
epic:
epic
,
issue:
issue
)
}
shared_examples
'epic in issue sidebar'
do
it
'shows epic in issue sidebar for projects with group'
do
visit
project_issue_path
(
project
,
issue
)
expect
(
page
.
find
(
'.block.epic .value'
)).
to
have_content
(
epic
.
title
)
end
it
'does not show epic in issue sidebar for personal projects'
do
personal_project
=
create
(
:project
,
:public
)
other_issue
=
create
(
:issue
,
project:
personal_project
)
visit
project_issue_path
(
personal_project
,
other_issue
)
expect_no_epic
end
end
context
'when epics available'
do
before
do
stub_licensed_features
(
epics:
true
)
sign_in
(
user
)
visit
project_issue_path
(
project
,
issue
)
end
it
'shows epic in issue sidebar'
do
expect
(
page
.
find
(
'.block.epic .value'
)).
to
have_content
(
epic
.
title
)
it_behaves_like
'epic in issue sidebar'
context
'with namespaced plans'
do
before
do
stub_application_setting
(
check_namespace_plan:
true
)
end
context
'group has license'
do
before
do
create
(
:gitlab_subscription
,
:gold
,
namespace:
group
)
end
it_behaves_like
'epic in issue sidebar'
end
context
'group has no license'
do
it
'does not show epic for public projects and groups'
do
visit
project_issue_path
(
project
,
issue
)
expect_no_epic
end
end
end
end
context
'when epics unavailable'
do
before
do
stub_licensed_features
(
epics:
false
)
sign_in
(
user
)
visit
project_issue_path
(
project
,
issue
)
end
it
'does not show epic in issue sidebar'
do
expect
(
page
).
not_to
have_selector
(
'.block.epic'
)
visit
project_issue_path
(
project
,
issue
)
expect_no_epic
end
end
def
expect_no_epic
expect
(
page
).
not_to
have_selector
(
'.block.epic'
)
end
end
ee/spec/features/merge_request/sidebar_spec.rb
0 → 100644
View file @
7e60a9e2
# frozen_string_literal: true
require
'spec_helper'
describe
'Merge Request sidebar'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
:public
,
group:
group
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
context
'when epics available'
do
before
do
stub_licensed_features
(
epics:
true
)
end
it
'does not show epics in MR sidebar'
do
visit
project_merge_request_path
(
project
,
merge_request
)
expect
(
page
).
not_to
have_selector
(
'.block.epic'
)
end
end
context
'when epics unavailable'
do
before
do
stub_licensed_features
(
epics:
false
)
end
it
'does not show epics promotion in MR sidebar'
do
visit
project_merge_request_path
(
project
,
merge_request
)
expect
(
page
).
not_to
have_selector
(
'.js-epics-sidebar-callout'
)
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