mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Eagerly load statuses with the main query in Api::V1::BookmarksController (#14674)
This is same with commit 552e886b64
except
that it was for Api::V1::FavouritesController while this is for
Api::V1::BookmarksController.
This commit is contained in:
parent
e26e7a1cb5
commit
b63ede5005
1 changed files with 2 additions and 5 deletions
|
@ -17,14 +17,11 @@ class Api::V1::BookmarksController < Api::BaseController
|
|||
end
|
||||
|
||||
def cached_bookmarks
|
||||
cache_collection(
|
||||
Status.reorder(nil).joins(:bookmarks).merge(results),
|
||||
Status
|
||||
)
|
||||
cache_collection(results.map(&:status), Status)
|
||||
end
|
||||
|
||||
def results
|
||||
@_results ||= account_bookmarks.paginate_by_id(
|
||||
@_results ||= account_bookmarks.eager_load(:status).paginate_by_id(
|
||||
limit_param(DEFAULT_STATUSES_LIMIT),
|
||||
params_slice(:max_id, :since_id, :min_id)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue