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
d27e1b5e
Commit
d27e1b5e
authored
Dec 21, 2020
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Block assign quick action for test cases
Prevent assign quick action for issues with test case type
parent
f006fea3
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
54 additions
and
4 deletions
+54
-4
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+4
-0
app/models/concerns/issue_available_features.rb
app/models/concerns/issue_available_features.rb
+3
-1
app/models/issue.rb
app/models/issue.rb
+4
-0
app/models/merge_request.rb
app/models/merge_request.rb
+4
-0
ee/app/models/concerns/ee/issuable.rb
ee/app/models/concerns/ee/issuable.rb
+1
-1
ee/app/models/ee/issue.rb
ee/app/models/ee/issue.rb
+5
-0
ee/changelogs/unreleased/issue_270585-block_assign_action.yml
...hangelogs/unreleased/issue_270585-block_assign_action.yml
+5
-0
ee/lib/ee/gitlab/quick_actions/issue_and_merge_request_actions.rb
...e/gitlab/quick_actions/issue_and_merge_request_actions.rb
+2
-1
ee/spec/services/quick_actions/interpret_service_spec.rb
ee/spec/services/quick_actions/interpret_service_spec.rb
+20
-0
lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
+1
-1
spec/services/quick_actions/interpret_service_spec.rb
spec/services/quick_actions/interpret_service_spec.rb
+5
-0
No files found.
app/models/concerns/issuable.rb
View file @
d27e1b5e
...
...
@@ -196,6 +196,10 @@ module Issuable
is_a?
(
Issue
)
end
def
supports_assignee?
false
end
def
severity
return
IssuableSeverity
::
DEFAULT
unless
supports_severity?
...
...
app/models/concerns/issue_available_features.rb
View file @
d27e1b5e
...
...
@@ -9,7 +9,9 @@ module IssueAvailableFeatures
class_methods
do
# EE only features are listed on EE::IssueAvailableFeatures
def
available_features_for_issue_types
{}.
with_indifferent_access
{
assignee:
%w(issue incident)
}.
with_indifferent_access
end
end
...
...
app/models/issue.rb
View file @
d27e1b5e
...
...
@@ -434,6 +434,10 @@ class Issue < ApplicationRecord
moved_to
||
duplicated_to
end
def
supports_assignee?
issue_type_supports?
(
:assignee
)
end
private
def
ensure_metrics
...
...
app/models/merge_request.rb
View file @
d27e1b5e
...
...
@@ -1774,6 +1774,10 @@ class MergeRequest < ApplicationRecord
false
end
def
supports_assignee?
true
end
private
def
with_rebase_lock
...
...
ee/app/models/concerns/ee/issuable.rb
View file @
d27e1b5e
...
...
@@ -6,7 +6,7 @@ module EE
extend
::
Gitlab
::
Utils
::
Override
def
supports_epic?
is_a?
(
Issue
)
&&
issue_type_supports?
(
:epics
)
&&
project
.
group
.
present?
false
end
def
supports_health_status?
...
...
ee/app/models/ee/issue.rb
View file @
d27e1b5e
...
...
@@ -251,6 +251,11 @@ module EE
super
||
promoted_to_epic
end
override
:supports_epic?
def
supports_epic?
issue_type_supports?
(
:epics
)
&&
project
.
group
.
present?
end
private
def
blocking_issues_ids
...
...
ee/changelogs/unreleased/issue_270585-block_assign_action.yml
0 → 100644
View file @
d27e1b5e
---
title
:
Block /assign quick action for test cases
merge_request
:
50396
author
:
type
:
other
ee/lib/ee/gitlab/quick_actions/issue_and_merge_request_actions.rb
View file @
d27e1b5e
...
...
@@ -14,7 +14,8 @@ module EE
params
'@user1 @user2'
types
Issue
,
MergeRequest
condition
do
quick_action_target
.
allows_multiple_assignees?
&&
quick_action_target
.
supports_assignee?
&&
quick_action_target
.
allows_multiple_assignees?
&&
quick_action_target
.
persisted?
&&
current_user
.
can?
(
:"admin_
#{
quick_action_target
.
to_ability_name
}
"
,
project
)
end
...
...
ee/spec/services/quick_actions/interpret_service_spec.rb
View file @
d27e1b5e
...
...
@@ -44,6 +44,16 @@ RSpec.describe QuickActions::InterpretService do
expect
(
updates
[
:assignee_ids
]).
to
match_array
([
user
.
id
,
user3
.
id
])
end
context
'with test_case issue type'
do
it
'does not mark to update assignee'
do
test_case
=
create
(
:quality_test_case
,
project:
project
)
_
,
updates
=
service
.
execute
(
"/assign @
#{
user3
.
username
}
"
,
test_case
)
expect
(
updates
[
:assignee_ids
]).
to
eq
(
nil
)
end
end
context
'assign command with multiple assignees'
do
it
'fetches assignee and populates assignee_ids if content contains /assign'
do
issue
.
update!
(
assignee_ids:
[
user
.
id
])
...
...
@@ -207,6 +217,16 @@ RSpec.describe QuickActions::InterpretService do
expect
(
updates
[
:assignee_ids
]).
to
match_array
([
current_user
.
id
])
end
context
'with test_case issue type'
do
it
'does not mark to update assignee'
do
test_case
=
create
(
:quality_test_case
,
project:
project
)
_
,
updates
=
service
.
execute
(
"/reassign @
#{
current_user
.
username
}
"
,
test_case
)
expect
(
updates
[
:assignee_ids
]).
to
eq
(
nil
)
end
end
end
end
...
...
lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
View file @
d27e1b5e
...
...
@@ -26,7 +26,7 @@ module Gitlab
end
types
Issue
,
MergeRequest
condition
do
current_user
.
can?
(
:"admin_
#{
quick_action_target
.
to_ability_name
}
"
,
project
)
quick_action_target
.
supports_assignee?
&&
current_user
.
can?
(
:"admin_
#{
quick_action_target
.
to_ability_name
}
"
,
project
)
end
parse_params
do
|
assignee_param
|
extract_users
(
assignee_param
)
...
...
spec/services/quick_actions/interpret_service_spec.rb
View file @
d27e1b5e
...
...
@@ -777,6 +777,11 @@ RSpec.describe QuickActions::InterpretService do
let
(
:issuable
)
{
issue
}
end
it_behaves_like
'assign command'
do
let
(
:content
)
{
"/assign @
#{
developer
.
username
}
"
}
let
(
:issuable
)
{
create
(
:incident
,
project:
project
)
}
end
it_behaves_like
'assign command'
do
let
(
:content
)
{
"/assign @
#{
developer
.
username
}
"
}
let
(
:issuable
)
{
merge_request
}
...
...
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