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
d690225d
Commit
d690225d
authored
Nov 05, 2021
by
Eugenia Grieff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add admin issue check to create epic issue link
parent
90d966c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
ee/app/services/epic_issues/create_service.rb
ee/app/services/epic_issues/create_service.rb
+1
-0
ee/spec/services/epic_issues/create_service_spec.rb
ee/spec/services/epic_issues/create_service_spec.rb
+7
-1
No files found.
ee/app/services/epic_issues/create_service.rb
View file @
d690225d
...
...
@@ -45,6 +45,7 @@ module EpicIssues
def
linkable_issue?
(
issue
)
issue
.
supports_epic?
&&
can?
(
current_user
,
:admin_issue
,
issue
.
project
)
&&
issuable_group_descendants
.
include?
(
issue
.
project
.
group
)
&&
!
previous_related_issuables
.
include?
(
issue
)
end
...
...
ee/spec/services/epic_issues/create_service_spec.rb
View file @
d690225d
...
...
@@ -160,9 +160,10 @@ RSpec.describe EpicIssues::CreateService do
# threshold 24 because 6 queries are generated for each insert
# (savepoint, find, exists, relative_position get, insert, release savepoint)
# and we insert 5 issues instead of 1 which we do for control count
# plus 4 to include additional authorization queries "SELECT MAX("project_authorizations"."access_level")"
expect
{
described_class
.
new
(
epic
,
user
,
params
).
execute
}
.
not_to
exceed_query_limit
(
control_count
)
.
with_threshold
(
29
)
.
with_threshold
(
33
)
end
end
...
...
@@ -179,6 +180,10 @@ RSpec.describe EpicIssues::CreateService do
subject
{
assign_issue
([
Gitlab
::
Routing
.
url_helpers
.
namespace_project_issue_url
(
namespace_id:
issue
.
project
.
namespace
,
project_id:
issue
.
project
,
id:
issue
.
iid
)])}
before
do
project2
.
add_reporter
(
user
)
end
include_examples
'returns success'
end
...
...
@@ -202,6 +207,7 @@ RSpec.describe EpicIssues::CreateService do
expect
(
created_link2
.
relative_position
).
to
be
<
created_link1
.
relative_position
end
it
'orders the epic issues to the first place and moves the existing ones down'
do
existing_link
=
create
(
:epic_issue
,
epic:
epic
,
issue:
issue3
)
...
...
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