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
72154b41
Commit
72154b41
authored
Nov 08, 2021
by
Eugenia Grieff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Review feedback
parent
d690225d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
36 deletions
+37
-36
ee/app/services/epic_issues/create_service.rb
ee/app/services/epic_issues/create_service.rb
+4
-0
ee/spec/models/issue_spec.rb
ee/spec/models/issue_spec.rb
+0
-9
ee/spec/requests/api/graphql/mutations/boards/issues/issue_move_list_spec.rb
...i/graphql/mutations/boards/issues/issue_move_list_spec.rb
+31
-24
ee/spec/services/epic_issues/create_service_spec.rb
ee/spec/services/epic_issues/create_service_spec.rb
+2
-3
No files found.
ee/app/services/epic_issues/create_service.rb
View file @
72154b41
...
@@ -37,6 +37,10 @@ module EpicIssues
...
@@ -37,6 +37,10 @@ module EpicIssues
@linkable_issues
||=
begin
@linkable_issues
||=
begin
return
[]
unless
can?
(
current_user
,
:read_epic
,
issuable
.
group
)
return
[]
unless
can?
(
current_user
,
:read_epic
,
issuable
.
group
)
Preloaders
::
UserMaxAccessLevelInProjectsPreloader
.
new
(
issues
.
map
(
&
:project
).
compact
,
current_user
)
.
execute
issues
.
select
do
|
issue
|
issues
.
select
do
|
issue
|
linkable_issue?
(
issue
)
linkable_issue?
(
issue
)
end
end
...
...
ee/spec/models/issue_spec.rb
View file @
72154b41
...
@@ -818,15 +818,6 @@ RSpec.describe Issue do
...
@@ -818,15 +818,6 @@ RSpec.describe Issue do
end
end
it
{
is_expected
.
to
be_truthy
}
it
{
is_expected
.
to
be_truthy
}
context
'when a user can not read epic'
do
before
do
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_epic
,
group
).
and_return
(
false
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:admin_issue
,
project
).
and_call_original
end
it
{
is_expected
.
to
be_falsey
}
end
end
end
end
end
...
...
ee/spec/requests/api/graphql/mutations/boards/issues/issue_move_list_spec.rb
View file @
72154b41
...
@@ -38,6 +38,10 @@ RSpec.describe 'Reposition and move issue within board lists' do
...
@@ -38,6 +38,10 @@ RSpec.describe 'Reposition and move issue within board lists' do
context
'when user can admin issue'
do
context
'when user can admin issue'
do
before
do
before
do
project
.
add_reporter
(
user
)
project
.
add_reporter
(
user
)
end
context
'when user can read epic'
do
before
do
group
.
add_guest
(
user
)
group
.
add_guest
(
user
)
end
end
...
@@ -75,6 +79,7 @@ RSpec.describe 'Reposition and move issue within board lists' do
...
@@ -75,6 +79,7 @@ RSpec.describe 'Reposition and move issue within board lists' do
expect
(
response_issue
[
'epic'
]).
to
be_nil
expect
(
response_issue
[
'epic'
]).
to
be_nil
end
end
end
end
end
context
'when user can not read epic'
do
context
'when user can not read epic'
do
let
(
:confidential_epic
)
{
create
(
:epic
,
:confidential
,
group:
group
)
}
let
(
:confidential_epic
)
{
create
(
:epic
,
:confidential
,
group:
group
)
}
...
@@ -85,6 +90,8 @@ RSpec.describe 'Reposition and move issue within board lists' do
...
@@ -85,6 +90,8 @@ RSpec.describe 'Reposition and move issue within board lists' do
response_issue
=
graphql_mutation_response
(
:issue_move_list
)[
'issue'
]
response_issue
=
graphql_mutation_response
(
:issue_move_list
)[
'issue'
]
expect
(
response_issue
[
'epic'
]).
to
be_nil
expect
(
response_issue
[
'epic'
]).
to
be_nil
expect
(
response_issue
[
'relativePosition'
]).
to
eq
(
3
)
expect
(
graphql_mutation_response
(
:issue_move_list
)[
'errors'
]).
to
include
(
'Resource not found'
)
end
end
end
end
end
end
...
...
ee/spec/services/epic_issues/create_service_spec.rb
View file @
72154b41
...
@@ -130,7 +130,7 @@ RSpec.describe EpicIssues::CreateService do
...
@@ -130,7 +130,7 @@ RSpec.describe EpicIssues::CreateService do
include_examples
'returns success'
include_examples
'returns success'
it
'does not perform N + 1 queries'
do
it
'does not perform N + 1 queries'
,
:request_store
do
allow
(
SystemNoteService
).
to
receive
(
:epic_issue
)
allow
(
SystemNoteService
).
to
receive
(
:epic_issue
)
allow
(
SystemNoteService
).
to
receive
(
:issue_on_epic
)
allow
(
SystemNoteService
).
to
receive
(
:issue_on_epic
)
...
@@ -160,10 +160,9 @@ RSpec.describe EpicIssues::CreateService do
...
@@ -160,10 +160,9 @@ RSpec.describe EpicIssues::CreateService do
# threshold 24 because 6 queries are generated for each insert
# threshold 24 because 6 queries are generated for each insert
# (savepoint, find, exists, relative_position get, insert, release savepoint)
# (savepoint, find, exists, relative_position get, insert, release savepoint)
# and we insert 5 issues instead of 1 which we do for control count
# 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
}
expect
{
described_class
.
new
(
epic
,
user
,
params
).
execute
}
.
not_to
exceed_query_limit
(
control_count
)
.
not_to
exceed_query_limit
(
control_count
)
.
with_threshold
(
33
)
.
with_threshold
(
29
)
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