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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
44945594
Commit
44945594
authored
Sep 11, 2017
by
micael.bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add association preloading for issue boards
parent
61b596a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
app/controllers/boards/issues_controller.rb
app/controllers/boards/issues_controller.rb
+9
-4
No files found.
app/controllers/boards/issues_controller.rb
View file @
44945594
...
@@ -11,9 +11,15 @@ module Boards
...
@@ -11,9 +11,15 @@ module Boards
issues
=
Boards
::
Issues
::
ListService
.
new
(
board_parent
,
current_user
,
filter_params
).
execute
issues
=
Boards
::
Issues
::
ListService
.
new
(
board_parent
,
current_user
,
filter_params
).
execute
issues
=
issues
.
page
(
params
[
:page
]).
per
(
params
[
:per
]
||
20
)
issues
=
issues
.
page
(
params
[
:page
]).
per
(
params
[
:per
]
||
20
)
make_sure_position_is_set
(
issues
)
make_sure_position_is_set
(
issues
)
issues
=
issues
.
preload
(
:project
,
:labels
,
:milestone
,
:assignees
,
:notes
=>
[
:award_emoji
,
:author
]
)
render
json:
{
render
json:
{
issues:
serialize_as_json
(
issues
.
preload
(
:project
)
),
issues:
serialize_as_json
(
issues
),
size:
issues
.
total_count
size:
issues
.
total_count
}
}
end
end
...
@@ -76,14 +82,13 @@ module Boards
...
@@ -76,14 +82,13 @@ module Boards
def
serialize_as_json
(
resource
)
def
serialize_as_json
(
resource
)
resource
.
as_json
(
resource
.
as_json
(
labels:
true
,
only:
[
:id
,
:iid
,
:project_id
,
:title
,
:confidential
,
:due_date
,
:relative_position
],
only:
[
:id
,
:iid
,
:project_id
,
:title
,
:confidential
,
:due_date
,
:relative_position
],
labels:
true
,
include:
{
include:
{
project:
{
only:
[
:id
,
:path
]
},
project:
{
only:
[
:id
,
:path
]
},
assignees:
{
only:
[
:id
,
:name
,
:username
],
methods:
[
:avatar_url
]
},
assignees:
{
only:
[
:id
,
:name
,
:username
],
methods:
[
:avatar_url
]
},
milestone:
{
only:
[
:id
,
:title
]
}
milestone:
{
only:
[
:id
,
:title
]
}
},
}
user:
current_user
)
)
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