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
330389ab
Commit
330389ab
authored
Jan 03, 2019
by
Jarka Košanová
Committed by
Lin Jen-Shin
Jan 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix unlabeling using quick actions for epics
parent
1454aa9f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
4 deletions
+39
-4
app/services/quick_actions/interpret_service.rb
app/services/quick_actions/interpret_service.rb
+5
-3
ee/app/helpers/ee/application_helper.rb
ee/app/helpers/ee/application_helper.rb
+1
-1
ee/spec/services/ee/notes/quick_actions_service_spec.rb
ee/spec/services/ee/notes/quick_actions_service_spec.rb
+33
-0
No files found.
app/services/quick_actions/interpret_service.rb
View file @
330389ab
...
@@ -210,8 +210,6 @@ module QuickActions
...
@@ -210,8 +210,6 @@ module QuickActions
end
end
params
'~label1 ~"label 2"'
params
'~label1 ~"label 2"'
condition
do
condition
do
parent
=
project
||
issuable_group
parent
&&
parent
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
parent
)
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
parent
)
&&
find_labels
.
any?
find_labels
.
any?
...
@@ -241,7 +239,7 @@ module QuickActions
...
@@ -241,7 +239,7 @@ module QuickActions
issuable
.
is_a?
(
Issuable
)
&&
issuable
.
is_a?
(
Issuable
)
&&
issuable
.
persisted?
&&
issuable
.
persisted?
&&
issuable
.
labels
.
any?
&&
issuable
.
labels
.
any?
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
p
rojec
t
)
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
p
aren
t
)
end
end
command
:unlabel
do
|
labels_param
=
nil
|
command
:unlabel
do
|
labels_param
=
nil
|
if
labels_param
.
present?
if
labels_param
.
present?
...
@@ -670,6 +668,10 @@ module QuickActions
...
@@ -670,6 +668,10 @@ module QuickActions
MilestonesFinder
.
new
(
params
.
merge
(
project_ids:
[
project
.
id
],
group_ids:
[
project
.
group
&
.
id
])).
execute
MilestonesFinder
.
new
(
params
.
merge
(
project_ids:
[
project
.
id
],
group_ids:
[
project
.
group
&
.
id
])).
execute
end
end
def
parent
project
||
issuable_group
end
def
issuable_group
def
issuable_group
strong_memoize
(
:issuable_group
)
do
strong_memoize
(
:issuable_group
)
do
issuable
.
group
if
issuable
.
respond_to?
(
:group
)
issuable
.
group
if
issuable
.
respond_to?
(
:group
)
...
...
ee/app/helpers/ee/application_helper.rb
View file @
330389ab
...
@@ -74,7 +74,7 @@ module EE
...
@@ -74,7 +74,7 @@ module EE
if
object
.
is_a?
(
Group
)
if
object
.
is_a?
(
Group
)
{
{
members:
members_group_autocomplete_sources_path
(
object
,
type:
noteable_type
,
type_id:
params
[
:id
]),
members:
members_group_autocomplete_sources_path
(
object
,
type:
noteable_type
,
type_id:
params
[
:id
]),
labels:
labels_group_autocomplete_sources_path
(
object
),
labels:
labels_group_autocomplete_sources_path
(
object
,
type:
noteable_type
,
type_id:
params
[
:id
]
),
epics:
epics_group_autocomplete_sources_path
(
object
),
epics:
epics_group_autocomplete_sources_path
(
object
),
commands:
commands_group_autocomplete_sources_path
(
object
,
type:
noteable_type
,
type_id:
params
[
:id
]),
commands:
commands_group_autocomplete_sources_path
(
object
,
type:
noteable_type
,
type_id:
params
[
:id
]),
milestones:
milestones_group_autocomplete_sources_path
(
object
)
milestones:
milestones_group_autocomplete_sources_path
(
object
)
...
...
ee/spec/services/ee/notes/quick_actions_service_spec.rb
View file @
330389ab
...
@@ -197,5 +197,38 @@ describe Notes::QuickActionsService do
...
@@ -197,5 +197,38 @@ describe Notes::QuickActionsService do
end
end
end
end
end
end
describe
'/label'
do
let
(
:project
)
{
nil
}
let!
(
:bug
)
{
create
(
:group_label
,
title:
'bug'
,
group:
group
)}
let!
(
:feature
)
{
create
(
:group_label
,
title:
'feature'
,
group:
group
)}
let
(
:note_text
)
{
"/unlabel ~bug"
}
let
(
:note
)
{
create
(
:note
,
noteable:
epic
,
note:
note_text
)
}
before
do
group
.
add_developer
(
user
)
epic
.
labels
=
[
bug
,
feature
]
end
context
'when epics are not enabled'
do
it
'does not remove any label'
do
expect
{
execute
(
note
)
}.
not_to
change
{
epic
.
reload
.
labels
}
end
end
context
'when epics are enabled'
do
before
do
stub_licensed_features
(
epics:
true
)
end
it
'removes a requested label from the epic'
do
expect
{
execute
(
note
)
}.
to
change
{
epic
.
reload
.
labels
.
map
(
&
:title
)
}.
to
([
'feature'
])
end
it
'leaves the note empty'
do
expect
(
execute
(
note
)).
to
eq
(
''
)
end
end
end
end
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