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
9b2450ca
Commit
9b2450ca
authored
Jan 13, 2020
by
Jan Provaznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use specific has_many relation
Adds has_many relation to get blocking issues.
parent
45762399
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
4 deletions
+8
-4
ee/app/controllers/ee/boards/issues_controller.rb
ee/app/controllers/ee/boards/issues_controller.rb
+1
-1
ee/app/models/ee/issue.rb
ee/app/models/ee/issue.rb
+2
-1
ee/app/serializers/ee/issue_board_entity.rb
ee/app/serializers/ee/issue_board_entity.rb
+1
-1
ee/spec/models/issue_spec.rb
ee/spec/models/issue_spec.rb
+2
-0
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+2
-1
No files found.
ee/app/controllers/ee/boards/issues_controller.rb
View file @
9b2450ca
...
...
@@ -7,7 +7,7 @@ module EE
override
:associations_to_preload
def
associations_to_preload
super
<<
{
target_issue_links:
{
source:
{
project: :project_feature
}
}
}
super
<<
{
blocked_by_issues:
{
project: :project_feature
}
}
end
end
end
...
...
ee/app/models/ee/issue.rb
View file @
9b2450ca
...
...
@@ -42,7 +42,8 @@ module EE
has_many
:vulnerability_links
,
class_name:
'Vulnerabilities::IssueLink'
,
inverse_of: :issue
has_many
:related_vulnerabilities
,
through: :vulnerability_links
,
source: :vulnerability
has_many
:target_issue_links
,
class_name:
'IssueLink'
,
foreign_key: :target_id
has_many
:blocked_by_issue_links
,
->
{
where
(
link_type:
IssueLink
::
TYPE_BLOCKS
)
},
class_name:
'IssueLink'
,
foreign_key: :target_id
has_many
:blocked_by_issues
,
through: :blocked_by_issue_links
,
source: :source
validates
:weight
,
allow_nil:
true
,
numericality:
{
greater_than_or_equal_to:
0
}
...
...
ee/app/serializers/ee/issue_board_entity.rb
View file @
9b2450ca
...
...
@@ -7,7 +7,7 @@ module EE
prepended
do
expose
:weight
,
if:
->
(
issue
,
_
)
{
issue
.
supports_weight?
}
expose
:blocked
do
|
issue
|
issue
.
target_issue_links
.
any?
{
|
link
|
link
.
link_type
==
IssueLink
::
TYPE_BLOCKS
&&
can?
(
request
.
current_user
,
:read_issue
,
link
.
sourc
e
)
}
issue
.
blocked_by_issues
.
any?
{
|
blocked_by_issue
|
can?
(
request
.
current_user
,
:read_issue
,
blocked_by_issu
e
)
}
end
end
end
...
...
ee/spec/models/issue_spec.rb
View file @
9b2450ca
...
...
@@ -127,6 +127,8 @@ describe Issue do
it
{
is_expected
.
to
have_many
(
:related_vulnerabilities
).
through
(
:vulnerability_links
).
source
(
:vulnerability
)
}
it
{
is_expected
.
to
belong_to
(
:promoted_to_epic
).
class_name
(
'Epic'
)
}
it
{
is_expected
.
to
have_many
(
:resource_weight_events
)
}
it
{
is_expected
.
to
have_many
(
:blocked_by_issue_links
)
}
it
{
is_expected
.
to
have_many
(
:blocked_by_issues
).
through
(
:blocked_by_issue_links
).
source
(
:source
)
}
describe
'versions.most_recent'
do
it
'returns the most recent version'
do
...
...
spec/lib/gitlab/import_export/all_models.yml
View file @
9b2450ca
...
...
@@ -38,7 +38,8 @@ issues:
-
vulnerability_links
-
related_vulnerabilities
-
user_mentions
-
target_issue_links
-
blocked_by_issue_links
-
blocked_by_issues
events
:
-
author
-
project
...
...
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