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
980c97e7
Commit
980c97e7
authored
Feb 28, 2022
by
Eugenia Grieff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply review suggestions
parent
1881821d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
21 deletions
+8
-21
ee/app/models/concerns/ee/issuable_link.rb
ee/app/models/concerns/ee/issuable_link.rb
+8
-6
ee/spec/support/shared_examples/models/concerns/issuable_links_shared_examples.rb
...xamples/models/concerns/issuable_links_shared_examples.rb
+0
-15
No files found.
ee/app/models/concerns/ee/issuable_link.rb
View file @
980c97e7
...
...
@@ -25,12 +25,6 @@ module EE
blocked_or_blocking_issuables
(
issuable
.
id
).
pluck
(
:source_id
)
end
def
blocked_or_blocking_issuables
(
issuables_ids
)
where
(
link_type:
::
IssueLink
::
TYPE_BLOCKS
).
where
(
target_id:
issuables_ids
)
.
joins
(
:source
)
.
where
(
source:
{
state_id:
::
Issuable
::
STATE_ID_MAP
[
:opened
]
})
end
def
blocking_issuables_for_collection
(
issuables_ids
)
open_state_id
=
::
Issuable
::
STATE_ID_MAP
[
:opened
]
grouping_row_name
=
"blocking_
#{
issuable_type
}
_id"
...
...
@@ -57,6 +51,14 @@ module EE
def
blocking_issuables_count_for
(
issue
)
blocking_issuables_for_collection
(
issue
.
id
)[
0
]
&
.
count
.
to_i
end
private
def
blocked_or_blocking_issuables
(
issuables_ids
)
where
(
link_type:
::
IssuableLink
::
TYPE_BLOCKS
).
where
(
target_id:
issuables_ids
)
.
joins
(
:source
)
.
where
(
source:
{
state_id:
::
Issuable
::
STATE_ID_MAP
[
:opened
]
})
end
end
end
end
ee/spec/support/shared_examples/models/concerns/issuable_links_shared_examples.rb
View file @
980c97e7
...
...
@@ -13,14 +13,6 @@ RSpec.shared_examples 'issuables that can block or be blocked' do
end
end
describe
'.inverse_link_type'
do
it
'returns the inverse type of link'
do
expect
(
described_class
.
inverse_link_type
(
'relates_to'
)).
to
eq
(
'relates_to'
)
expect
(
described_class
.
inverse_link_type
(
'is_blocked_by'
)).
to
eq
(
'is_blocked_by'
)
expect
(
described_class
.
inverse_link_type
(
'blocks'
)).
to
eq
(
'is_blocked_by'
)
end
end
describe
'.blocked_issuable_ids'
do
it
'returns only ids of issues which are blocked'
do
link1
=
create
(
factory_class
,
link_type:
::
IssuableLink
::
TYPE_BLOCKS
)
...
...
@@ -43,13 +35,6 @@ RSpec.shared_examples 'issuables that can block or be blocked' do
end
end
describe
'.inverse_link_type'
do
it
'returns reverse type of link'
do
expect
(
described_class
.
inverse_link_type
(
'relates_to'
)).
to
eq
'relates_to'
expect
(
described_class
.
inverse_link_type
(
'blocks'
)).
to
eq
'is_blocked_by'
end
end
context
'blocking issuables count'
do
before
:all
do
create
(
factory_class
,
source:
blocking_issuable_1
,
target:
blocked_issuable_1
,
link_type:
::
IssuableLink
::
TYPE_BLOCKS
)
...
...
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